start using the bindings
This commit is contained in:
parent
9403c90082
commit
02b9d5fb82
39
quicp2p.nim
39
quicp2p.nim
|
@ -1,26 +1,29 @@
|
|||
{.passL: "-l quicly -l picotls-core -l picotls-openssl".}
|
||||
{.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"
|
||||
|
||||
#type
|
||||
# PtlsGetTime {.pure, final.} = pointer
|
||||
#
|
||||
# PtlsContext {.importc: "struct ptls_context_t", pure, final,
|
||||
# header: "picotls.h".} = object
|
||||
# random_bytes: proc(buf: pointer, len: csize_t) {.cdecl.}
|
||||
# get_time: ptr PtlsGetTime
|
||||
# key_exchanges: ptr ptr PtlsKeyExchangeAlgorithm
|
||||
# cipher_suites: ptr ptr PtlsCipherSuite
|
||||
# certificates:
|
||||
#
|
||||
#
|
||||
# proc
|
||||
#
|
||||
#
|
||||
#proc main() =
|
||||
# ptlsContext =
|
||||
when isMainModule:
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue