summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/client.go16
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