Skip to content

Comments

feat: introduce TLSConn abstraction and use it consistently#4

Merged
bassosimone merged 1 commit intomainfrom
utls-abstraction
Aug 12, 2021
Merged

feat: introduce TLSConn abstraction and use it consistently#4
bassosimone merged 1 commit intomainfrom
utls-abstraction

Conversation

@bassosimone
Copy link
Contributor

With this abstraction in place, it's quite easy to use
github.com/refraction-networkings/utls with this net/http fork.

> git grep 'tls\.Conn'
cgi/child.go:           r.TLS = &tls.ConnectionState{HandshakeComplete: true}
h2_bundle.go:   ConnectionState() tls.ConnectionState
h2_bundle.go:// client. If c has a ConnectionState method like a *tls.Conn, the
h2_bundle.go:           sc.tlsState = new(tls.ConnectionState)
h2_bundle.go:   tlsState         *tls.ConnectionState        // shared by all handlers, like net/http
h2_bundle.go:                   // TODO: add CloseWrite to crypto/tls.Conn first
h2_bundle.go:   var tlsState *tls.ConnectionState // nil if not scheme https
h2_bundle.go:   // If the returned net.Conn has a ConnectionState method like tls.Conn,
h2_bundle.go:   tlsState  *tls.ConnectionState // nil only for specialized impls
httptest/httptest.go:           req.TLS = &tls.ConnectionState{
httptest/httptest_test.go:                              TLS: &tls.ConnectionState{
httptrace/trace.go:     TLSHandshakeDone func(tls.ConnectionState, error)
request.go:     TLS *tls.ConnectionState
response.go:    TLS *tls.ConnectionState
server.go:      tlsState *tls.ConnectionState
server.go:              c.tlsState = new(tls.ConnectionState)
server.go:              req.TLS = &tls.ConnectionState{}
tlsconn.go:// TLSConn is the interface representing a *tls.Conn compatible
tlsconn.go:// connection, which could possibly be different from a *tls.Conn
tlsconn.go:     ConnectionState() tls.ConnectionState
transport.go:                   trace.TLSHandshakeDone(tls.ConnectionState{}, err)
transport.go:                                   trace.TLSHandshakeDone(tls.ConnectionState{}, err)
transport.go:   tlsState  *tls.ConnectionState
transport_test.go:              TLSHandshakeDone: func(s tls.ConnectionState, err error) {
transport_test.go:              TLSHandshakeDone: func(s tls.ConnectionState, err error) {
transport_test.go:                      TLSHandshakeDone: func(cfg tls.ConnectionState, err error) {

With this abstraction in place, it's quite easy to use
github.com/refraction-networkings/utls with this net/http fork.

```
> git grep 'tls\.Conn'
cgi/child.go:           r.TLS = &tls.ConnectionState{HandshakeComplete: true}
h2_bundle.go:   ConnectionState() tls.ConnectionState
h2_bundle.go:// client. If c has a ConnectionState method like a *tls.Conn, the
h2_bundle.go:           sc.tlsState = new(tls.ConnectionState)
h2_bundle.go:   tlsState         *tls.ConnectionState        // shared by all handlers, like net/http
h2_bundle.go:                   // TODO: add CloseWrite to crypto/tls.Conn first
h2_bundle.go:   var tlsState *tls.ConnectionState // nil if not scheme https
h2_bundle.go:   // If the returned net.Conn has a ConnectionState method like tls.Conn,
h2_bundle.go:   tlsState  *tls.ConnectionState // nil only for specialized impls
httptest/httptest.go:           req.TLS = &tls.ConnectionState{
httptest/httptest_test.go:                              TLS: &tls.ConnectionState{
httptrace/trace.go:     TLSHandshakeDone func(tls.ConnectionState, error)
request.go:     TLS *tls.ConnectionState
response.go:    TLS *tls.ConnectionState
server.go:      tlsState *tls.ConnectionState
server.go:              c.tlsState = new(tls.ConnectionState)
server.go:              req.TLS = &tls.ConnectionState{}
tlsconn.go:// TLSConn is the interface representing a *tls.Conn compatible
tlsconn.go:// connection, which could possibly be different from a *tls.Conn
tlsconn.go:     ConnectionState() tls.ConnectionState
transport.go:                   trace.TLSHandshakeDone(tls.ConnectionState{}, err)
transport.go:                                   trace.TLSHandshakeDone(tls.ConnectionState{}, err)
transport.go:   tlsState  *tls.ConnectionState
transport_test.go:              TLSHandshakeDone: func(s tls.ConnectionState, err error) {
transport_test.go:              TLSHandshakeDone: func(s tls.ConnectionState, err error) {
transport_test.go:                      TLSHandshakeDone: func(cfg tls.ConnectionState, err error) {
```
@bassosimone bassosimone merged commit 0c2792a into main Aug 12, 2021
@bassosimone bassosimone deleted the utls-abstraction branch August 12, 2021 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant