mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net.mbedtls: add SSLListener to allow creating SSL servers (#19022)
This commit is contained in:
17
examples/ssl_server/client.v
Normal file
17
examples/ssl_server/client.v
Normal file
@ -0,0 +1,17 @@
|
||||
import io
|
||||
import os
|
||||
import net.mbedtls
|
||||
|
||||
fn main() {
|
||||
mut client := mbedtls.new_ssl_conn(mbedtls.SSLConnectConfig{
|
||||
verify: os.resource_abs_path('cert/ca.crt')
|
||||
cert: os.resource_abs_path('cert/client.crt')
|
||||
cert_key: os.resource_abs_path('cert/client.key')
|
||||
validate: true
|
||||
})!
|
||||
|
||||
client.dial('localhost', 8443)!
|
||||
client.write_string('GET / HTTP/1.1\r\n\r\n')!
|
||||
mut reader := io.new_buffered_reader(reader: client)
|
||||
println(reader.read_line()!)
|
||||
}
|
Reference in New Issue
Block a user