space monkey internal commit export

[katamari commit: 0b4b2864fe889ae19bf082e6c87cbb90965ed6b3]
This commit is contained in:
paul cannon 2014-04-27 16:03:26 -06:00
parent 12a1657a95
commit 5d58645e49

14
conn.go
View File

@ -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
}