Break out default TLS and QUIC configs
This commit is contained in:
parent
b6d6b1d777
commit
06d5e60341
15
dial.go
15
dial.go
@ -33,7 +33,7 @@ func (diale Dialer) dialQUIC(ctx context.Context, network, address string) (Conn
|
||||
if err != nil { return nil, err }
|
||||
udpConn, err := net.DialUDP(udpNetwork, nil, addr)
|
||||
if err != nil { return nil, err }
|
||||
conn, err := quic.Dial(ctx, udpConn, addr, diale.tlsConfig(), diale.quicConfig())
|
||||
conn, err := quic.Dial(ctx, udpConn, addr, tlsConfig(diale.TLSConfig), quicConfig())
|
||||
if err != nil { return nil, err }
|
||||
return AdaptB(quicMultiConn { underlying: conn }), nil
|
||||
}
|
||||
@ -44,21 +44,22 @@ func (diale Dialer) dialUnix(ctx context.Context, network, address string) (Conn
|
||||
if err != nil { return nil, err }
|
||||
conn, err := net.DialUnix(network, nil, addr)
|
||||
if err != nil { return nil, err }
|
||||
// REMEMBER - THIS IS VERY IMPORTANT:
|
||||
// WHEN YOU INEVITABLY COPY PASTE THIS FOR THE SERVER-SIDE, CHANGE THE
|
||||
// PARTY CONSTANT TO ServerSide! OTHERWISE THERE WILL BE COLLISIONS!
|
||||
return AdaptA(conn, ClientSide), nil
|
||||
}
|
||||
|
||||
func (diale Dialer) tlsConfig() *tls.Config {
|
||||
conf := diale.TLSConfig.Clone()
|
||||
func tlsConfig(conf *tls.Config) *tls.Config {
|
||||
if conf == nil {
|
||||
conf = &tls.Config { }
|
||||
} else {
|
||||
conf = conf.Clone()
|
||||
}
|
||||
conf.NextProtos = []string {
|
||||
"HOPP/0",
|
||||
}
|
||||
return conf
|
||||
}
|
||||
|
||||
func (diale Dialer) quicConfig() *quic.Config {
|
||||
func quicConfig() *quic.Config {
|
||||
return &quic.Config {
|
||||
// TODO: perhaps we might want to put something here
|
||||
// the quic config shouldn't be exported, just set up
|
||||
|
Loading…
Reference in New Issue
Block a user