quicp2p/quicp2p.nim

30 lines
914 B
Nim

{.passL: "-l quicly -l picotls-core -l picotls-openssl -l crypto".}
import quicly/quicly
import quicly/defaults
import picotls/picotls
import picotls/openssl
proc onStreamOpen(self: ptr quicly_stream_open_t, stream: ptr quicly_stream_t):
cint {.cdecl.} =
echo "onStreamOpen!"
proc main() =
# callbacks
var streamOpen = quicly_stream_open_t(cb: onStreamOpen)
var signCertificates: ptls_openssl_sign_certificate_t
var tlsCtx = ptls_context_t(randomBytes: ptlsOpensslRandomBytes,
getTime: addr ptlsGetTime,
keyExchanges: ptlsOpensslKeyExchanges,
cipherSuites: ptlsOpensslCipherSuites)
quiclyAmendPtlsContext(addr tlsCtx)
var ctx = quiclySpecContext
ctx.tls = addr tlsCtx
ctx.stream_open = addr streamOpen
# TODO: ptls_load_certificates
echo "hello world"
when isMainModule:
main()