Skip to content

hpkp Dialer compatability with HTTP2 #14

Open
@ghost

Description

Trying to use your dialer against http2.Transport seems to fail
Looks like http2.Transport.DialTLS expects

type Transport struct {
...
DialTLS func(network, addr string, cfg *tls.Config) (net.Conn, error)

See: https://github.com/golang/net/blob/master/http2/transport.go

Where your DialTLS doesn't accept a tls.Config

https://github.com/tam7t/hpkp/blob/master/dialer.go

My Error:

./https.go:63: cannot use hpkpDialConf.NewDialer() (type func(string, string) (net.Conn, error)) as type func(string, string, *tls.Config) (net.Conn, error) in assignment

Code is here:
https://github.com/GinoM/dingo/tree/hpkp-pinning

Your code works fine against http.Transport though.

I feel like there is probably a better solution but maybe you can add something like

func (c *DialerConfig) NewDialer2() func(network, addr string, cfg *tls.Config) (net.Conn, error) {
        c.TLSConfig = cfg
	reporter := c.Reporter
	if reporter == nil {
		reporter = emptyReporter
	}

	return newPinDialer(c.Storage, reporter, c.PinOnly, c.TLSConfig)
}```

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions