1
0
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:
Lucas V. Araujo
2023-08-01 06:45:50 -11:00
committed by GitHub
parent 600f891d3a
commit ecca3b155e
9 changed files with 382 additions and 1 deletions

View 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()!)
}