start using the bindings

This commit is contained in:
Christian Ulrich 2020-11-02 10:00:33 +01:00
parent 9403c90082
commit 02b9d5fb82
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 21 additions and 18 deletions

View File

@ -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()