From 004572df2e755e2b6647a7d5e8b43fa632e53625 Mon Sep 17 00:00:00 2001 From: Sergey Frolov Date: Wed, 6 Sep 2017 19:26:38 -0600 Subject: [PATCH] Make ApplyConfig() and MarshalClientHello() public --- u_conn.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/u_conn.go b/u_conn.go index e439245..d878304 100644 --- a/u_conn.go +++ b/u_conn.go @@ -7,6 +7,7 @@ package tls import ( "bufio" "bytes" + "crypto/cipher" "encoding/binary" "errors" "io" @@ -14,7 +15,6 @@ import ( "strconv" "sync" "sync/atomic" - "crypto/cipher" ) type UConn struct { @@ -60,11 +60,11 @@ func (uconn *UConn) BuildHandshakeState() error { if err != nil { return err } - err = uconn.applyConfig() + err = uconn.ApplyConfig() if err != nil { return err } - err = uconn.marshalClientHello() + err = uconn.MarshalClientHello() if err != nil { return err } @@ -267,7 +267,6 @@ func (c *UConn) Write(b []byte) (int, error) { return n + m, c.out.setErrorLocked(err) } - // c.out.Mutex <= L; c.handshakeMutex <= L. func (c *UConn) clientHandshakeWithState(hs *clientHandshakeState) error { // This code was copied almost as is from tls/handshake_client.go @@ -350,7 +349,7 @@ func (c *UConn) clientHandshakeWithState(hs *clientHandshakeState) error { return nil } -func (uconn *UConn) applyConfig() error { +func (uconn *UConn) ApplyConfig() error { for _, ext := range uconn.Extensions { err := ext.writeToUConn(uconn) if err != nil { @@ -360,7 +359,7 @@ func (uconn *UConn) applyConfig() error { return nil } -func (uconn *UConn) marshalClientHello() error { +func (uconn *UConn) MarshalClientHello() error { hello := uconn.HandshakeState.Hello headerLength := 2 + 32 + 1 + len(hello.SessionId) + 2 + len(hello.CipherSuites)*2 +