mirror of
https://github.com/libp2p/go-openssl.git
synced 2025-01-29 05:10:10 +08:00
space monkey internal commit export
[katamari commit: 0b4b2864fe889ae19bf082e6c87cbb90965ed6b3]
This commit is contained in:
parent
12a1657a95
commit
5d58645e49
14
conn.go
14
conn.go
@ -11,6 +11,9 @@ package openssl
|
||||
// X509 *sk_X509_value_not_a_macro(STACK_OF(X509)* sk, int i) {
|
||||
// return sk_X509_value(sk, i);
|
||||
// }
|
||||
// long SSL_set_tlsext_host_name_not_a_macro(SSL *ssl, const char *name) {
|
||||
// return SSL_set_tlsext_host_name(ssl, name);
|
||||
// }
|
||||
import "C"
|
||||
|
||||
import (
|
||||
@ -465,3 +468,14 @@ func (c *Conn) SetWriteDeadline(t time.Time) error {
|
||||
func (c *Conn) UnderlyingConn() net.Conn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
func (c *Conn) SetTlsExtHostName(name string) error {
|
||||
bname := []byte(name)
|
||||
cname := (*C.char)(unsafe.Pointer(&bname[0]))
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
if C.SSL_set_tlsext_host_name_not_a_macro(c.ssl, cname) == 0 {
|
||||
return errorFromErrorQueue()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user