quicp2p/quicp2p.nim

30 lines
914 B
Nim
Raw Normal View History

2020-11-02 10:00:33 +01:00
{.passL: "-l quicly -l picotls-core -l picotls-openssl -l crypto".}
2020-11-02 00:52:13 +01:00
import quicly/quicly
2020-11-02 10:00:33 +01:00
import quicly/defaults
2020-11-02 00:52:13 +01:00
import picotls/picotls
import picotls/openssl
2020-11-02 10:00:33 +01:00
proc onStreamOpen(self: ptr quicly_stream_open_t, stream: ptr quicly_stream_t):
cint {.cdecl.} =
echo "onStreamOpen!"
2020-11-02 00:52:13 +01:00
proc main() =
2020-11-02 10:00:33 +01:00
# 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
2020-11-02 00:52:13 +01:00
echo "hello world"
2020-11-02 10:00:33 +01:00
when isMainModule:
main()