diff options
author | atanarjuat <atanarjuat@example.com> | 2022-05-30 19:14:02 +0200 |
---|---|---|
committer | atanarjuat <atanarjuat@example.com> | 2022-05-30 19:14:02 +0200 |
commit | ae8664bec8a34bc758184e5c72141e26a1c960da (patch) | |
tree | d40154885facfbba68799f1e1846c2cfb380f3b6 /client/client.go | |
parent | 50c5fdc8a15f37d506292b02eef992e83752152b (diff) |
quic dialerfeat/quic
Diffstat (limited to 'client/client.go')
-rw-r--r-- | client/client.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/client/client.go b/client/client.go index c0a42e0..371cf88 100644 --- a/client/client.go +++ b/client/client.go @@ -1,25 +1,30 @@ package client import ( + "crypto/tls" "fmt" "log" "net" "0xacab.org/leap/obfsvpn" + "0xacab.org/leap/obfsvpn/quicwrapper" "github.com/kalikaneko/socks5" + "github.com/lucas-clemente/quic-go" "github.com/xtaci/kcp-go" ) type Client struct { kcp bool + quic bool socksAddr string obfs4Cert string } -func NewClient(kcp bool, socksAddr, obfs4Cert string) *Client { +func NewClient(kcp, quic bool, socksAddr, obfs4Cert string) *Client { return &Client{ kcp: kcp, + quic: quic, socksAddr: socksAddr, obfs4Cert: obfs4Cert, } @@ -42,6 +47,15 @@ func (c *Client) Start() bool { log.Printf("Dialing kcp://%s\n", address) return kcp.Dial(address) } + } else if c.quic { + dialer.DialFunc = func(network, address string) (net.Conn, error) { + tlsConfig := &tls.Config{ + InsecureSkipVerify: true, // TODO proper pinning + NextProtos: []string{"quic-echo-example"}, // XXX what is this??? + } + c := quicwrapper.NewClient(address, tlsConfig, &quic.Config{}, nil) + return c.Dial() + } } server.Dial = dialer.Dial |