|
|
@ -23,16 +23,7 @@ func NewConnContext(c net.Conn) *ConnContext {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type serverConn struct {
|
|
|
|
func (connCtx *ConnContext) InitHttpServer(sslInsecure bool, connWrap func(net.Conn) net.Conn, whenServerConnected func()) {
|
|
|
|
net.Conn
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *serverConn) Close() error {
|
|
|
|
|
|
|
|
log.Debugln("in http serverConn close")
|
|
|
|
|
|
|
|
return c.Conn.Close()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (connCtx *ConnContext) InitHttpServer(SslInsecure bool) {
|
|
|
|
|
|
|
|
if connCtx.Server != nil {
|
|
|
|
if connCtx.Server != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -55,15 +46,16 @@ func (connCtx *ConnContext) InitHttpServer(SslInsecure bool) {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cw := &serverConn{c}
|
|
|
|
cw := connWrap(c)
|
|
|
|
server.Conn = cw
|
|
|
|
server.Conn = cw
|
|
|
|
|
|
|
|
defer whenServerConnected()
|
|
|
|
return cw, nil
|
|
|
|
return cw, nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ForceAttemptHTTP2: false, // disable http2
|
|
|
|
ForceAttemptHTTP2: false, // disable http2
|
|
|
|
|
|
|
|
|
|
|
|
DisableCompression: true, // To get the original response from the server, set Transport.DisableCompression to true.
|
|
|
|
DisableCompression: true, // To get the original response from the server, set Transport.DisableCompression to true.
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
InsecureSkipVerify: SslInsecure,
|
|
|
|
InsecureSkipVerify: sslInsecure,
|
|
|
|
KeyLogWriter: GetTlsKeyLogWriter(),
|
|
|
|
KeyLogWriter: GetTlsKeyLogWriter(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -75,7 +67,7 @@ func (connCtx *ConnContext) InitHttpServer(SslInsecure bool) {
|
|
|
|
connCtx.Server = server
|
|
|
|
connCtx.Server = server
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (connCtx *ConnContext) InitHttpsServer(SslInsecure bool) {
|
|
|
|
func (connCtx *ConnContext) InitHttpsServer(sslInsecure bool) {
|
|
|
|
if connCtx.Server != nil {
|
|
|
|
if connCtx.Server != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -97,7 +89,7 @@ func (connCtx *ConnContext) InitHttpsServer(SslInsecure bool) {
|
|
|
|
|
|
|
|
|
|
|
|
DisableCompression: true, // To get the original response from the server, set Transport.DisableCompression to true.
|
|
|
|
DisableCompression: true, // To get the original response from the server, set Transport.DisableCompression to true.
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
InsecureSkipVerify: SslInsecure,
|
|
|
|
InsecureSkipVerify: sslInsecure,
|
|
|
|
KeyLogWriter: GetTlsKeyLogWriter(),
|
|
|
|
KeyLogWriter: GetTlsKeyLogWriter(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|