mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-09-12 19:24:32 +00:00
Implement TUN, no ACL support yet
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/tobyxdd/hysteria/pkg/socks5"
|
||||
"github.com/tobyxdd/hysteria/pkg/tproxy"
|
||||
"github.com/tobyxdd/hysteria/pkg/transport"
|
||||
"github.com/tobyxdd/hysteria/pkg/tun"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
@@ -188,6 +189,17 @@ func client(config *clientConfig) {
|
||||
}()
|
||||
}
|
||||
|
||||
if len(config.TUN.Name) != 0 {
|
||||
go func() {
|
||||
tunServer, err := tun.NewServer(client, time.Duration(config.TUN.Timeout)*time.Second,
|
||||
config.TUN.Name, config.TUN.Address, config.TUN.Gateway, config.TUN.Mask, config.TUN.DNS, config.TUN.Persist)
|
||||
if err != nil {
|
||||
logrus.WithField("error", err).Fatal("Failed to initialize TUN server")
|
||||
}
|
||||
errChan <- tunServer.ListenAndServe()
|
||||
}()
|
||||
}
|
||||
|
||||
if len(config.TCPRelay.Listen) > 0 {
|
||||
go func() {
|
||||
rl, err := relay.NewTCPRelay(client, transport.DefaultTransport,
|
||||
|
Reference in New Issue
Block a user