Skip to content

Commit

Permalink
feat: add factory for TLS proxying with uTLS (v2)
Browse files Browse the repository at this point in the history
This commit adds an experimental factory for create proxying
TLS connections using uTLS rather than crypto/tls.

A user has requested this functionality.

For now, I'd like to avoid advertising it until I get confirmation
that this interface is okay for the user who requested it.

When it's confirmed it's okay, I'll change the README.

The v1 implementation of this functionality was in commit
d6f7e24. Yet, it turns out the
TLSClientFactory ended up having the wrong return type
(`*tls.Conn`). This return type is incorrect; the factory needs
to return `oohttp.TLSConn` instead.
  • Loading branch information
bassosimone committed Jan 4, 2022
1 parent a141311 commit 475e580
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tlsconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ type TLSConn interface {
}

// TLSClientFactory is the factory used when creating connections
// using a proxy inside of the HTTP library. By default, this is
// the tls.Client function. You'll need to override this factory if
// using a proxy inside of the HTTP library. By default, this will
// call the tls.Client func. You'll need to override this factory if
// you want to use refraction-networking/utls for proxied conns.
var TLSClientFactory = tls.Client
var TLSClientFactory = func(conn net.Conn, config *tls.Config) TLSConn {
return tls.Client(conn, config)
}

0 comments on commit 475e580

Please sign in to comment.