mirror of
https://github.com/boringproxy/boringproxy.git
synced 2026-11-02 09:48:49 -06:00
Merge pull request #164 from boringproxy/fix-client-tls-bug
Fix client TLS bug
This commit is contained in:
2 files changed
+20
-7
No files matched your search
+1
-1
@@ -109,7 +109,7 @@ func Listen() {
|
||||
}
|
||||
|
||||
if *acceptCATerms {
|
||||
certmagic.DefaultACME.Agreed = true
|
||||
certmagic.DefaultACME.Agreed = true
|
||||
log.Print(fmt.Sprintf("Automatic agreement to CA terms with email (%s)", *acmeEmail))
|
||||
}
|
||||
|
||||
|
||||
@@ -345,17 +345,30 @@ func (c *Client) BoreTunnel(ctx context.Context, tunnel Tunnel) error {
|
||||
break
|
||||
//continue
|
||||
}
|
||||
|
||||
// If ALPN type is acme-tls/1, certmagic will do its thing under the hood, and the
|
||||
// connection should not be used.
|
||||
if tlsConn, ok := conn.(*tls.Conn); ok {
|
||||
tlsConn.Handshake()
|
||||
if tlsConn.ConnectionState().NegotiatedProtocol == "acme-tls/1" {
|
||||
tlsConn.Close()
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
go c.handleConnection(conn, tunnel.ClientAddress, tunnel.ClientPort)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// TODO: There's still quite a bit of duplication with what the server does. Could we
|
||||
// encapsulate it into a type?
|
||||
err = c.certConfig.ManageSync(ctx, []string{tunnel.Domain})
|
||||
if err != nil {
|
||||
log.Println("CertMagic error at startup")
|
||||
log.Println(err)
|
||||
if tunnel.TlsTermination != "passthrough" {
|
||||
// TODO: There's still quite a bit of duplication with what the server does. Could we
|
||||
// encapsulate it into a type?
|
||||
err = c.certConfig.ManageSync(ctx, []string{tunnel.Domain})
|
||||
if err != nil {
|
||||
log.Println("CertMagic error at startup")
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
<-ctx.Done()
|
||||
|
||||
Reference in new issue
Block a user