@@ -74,23 +74,23 @@ static long SSL_CTX_set_tlsext_servername_callback_not_a_macro(SSL_CTX* ctx, voi
74
74
return SSL_CTX_set_tlsext_servername_callback(ctx, fp);
75
75
}
76
76
77
- typedef struct TlsServernameData {
77
+ typedef struct TlsExtData {
78
78
void *go_ctx;
79
79
SSL_CTX *ctx;
80
80
void *arg;
81
- } TlsServernameData ;
81
+ } TlsExtData ;
82
82
83
- extern int callServerNameCb (SSL* ssl, int ad, void* arg);
83
+ extern int callServernameCb (SSL* ssl, int ad, void* arg);
84
84
85
85
static int call_go_servername(SSL* ssl, int ad, void* arg) {
86
- return callServerNameCb (ssl, ad, arg);
86
+ return callServernameCb (ssl, ad, arg);
87
87
}
88
88
89
- static int servername_gateway(TlsServernameData * cw) {
89
+ static int servername_gateway(TlsExtData * cw) {
90
90
SSL_CTX* ctx = cw->ctx;
91
91
//TODO: figure out what to do with return codes. The first isn't 0
92
92
SSL_CTX_set_tlsext_servername_callback(ctx, call_go_servername);
93
- SSL_CTX_set_tlsext_servername_arg(ctx, cw);
93
+ SSL_CTX_set_tlsext_servername_arg(ctx, cw.arg );
94
94
return 0;
95
95
}
96
96
@@ -141,13 +141,13 @@ var (
141
141
)
142
142
143
143
type Ctx struct {
144
- ctx * C.SSL_CTX
145
- cert * Certificate
146
- chain []* Certificate
147
- key PrivateKey
148
- verify_cb VerifyCallback
149
- servername_cb ServerNameCallback
150
- ted C. TlsServernameData
144
+ ctx * C.SSL_CTX
145
+ cert * Certificate
146
+ chain []* Certificate
147
+ key PrivateKey
148
+ verify_cb VerifyCallback
149
+ // servername_cb ServerNameCallback
150
+ servername_cb func ( ssl Conn , ad int , arg unsafe. Pointer ) int
151
151
}
152
152
153
153
//export get_ssl_ctx_idx
@@ -634,11 +634,11 @@ func (c *Ctx) SessGetCacheSize() int {
634
634
635
635
// Set SSL_CTX_set_tlsext_servername_callback
636
636
// https://www.openssl.org/docs/manmaster/ssl/???
637
- type ServerNameCallback func (ssl Conn , ad int , arg unsafe.Pointer ) int
637
+ // type ServerNameCallback func(ssl *C.SSL , ad C. int, arg unsafe.Pointer) int
638
638
639
- //export callServerNameCb
640
- func callServerNameCb (ssl * C.SSL , ad C.int , arg unsafe.Pointer ) C.int {
641
- var ted * C.TlsServernameData = (* C .TlsServernameData )(arg )
639
+ //export callServernameCb
640
+ func callServernameCb (ssl * C.SSL , ad C.int , arg unsafe.Pointer ) C.int {
641
+ var ted * C.TlsExtData = (* C .TlsExtData )(arg )
642
642
goCtx := (* Ctx )(ted .go_ctx )
643
643
644
644
//setup a dummy Conn so we can associate a SSL_CTX from user callback
@@ -650,13 +650,13 @@ func callServerNameCb(ssl *C.SSL, ad C.int, arg unsafe.Pointer) C.int {
650
650
return C .int (ret )
651
651
}
652
652
653
- func (c * Ctx ) SetTlsExtServerNameCallback (cb func ( ssl Conn , ad int , arg unsafe. Pointer ) int ,
654
- arg unsafe.Pointer ) int {
653
+ // func (c *Ctx) SetTlsExtServerNameCallback(cb ServerNameCallback ) int {
654
+ func ( c * Ctx ) SetTlsExtServerNameCallback ( cb func ( ssl Conn , ad int , arg unsafe. Pointer ) int , arg unsafe.Pointer ) int {
655
655
c .servername_cb = cb
656
- c . ted = C.TlsServernameData {
656
+ cw : = C.TlsExtData {
657
657
go_ctx : unsafe .Pointer (c ),
658
658
ctx : c .ctx ,
659
659
arg : arg ,
660
660
}
661
- return int (C .servername_gateway (& c . ted ))
661
+ return int (C .servername_gateway (& cw ))
662
662
}
0 commit comments