This commit is contained in:
idk 2018-12-25 03:58:16 -05:00
parent b65cd52418
commit 8a9c747dbd
No known key found for this signature in database
GPG key ID: D75C03B39B5E14E1
2 changed files with 14 additions and 1 deletions

View file

@ -148,7 +148,9 @@ func main() {
} }
} }
}() }()
tunsocks.Serve() if err := tunsocks.Serve(); err != nil {
log.Println(err.Error())
}
} else { } else {
panic(tunerr) panic(tunerr)
} }

View file

@ -20,12 +20,21 @@ type Manager struct {
*sam3.SAM *sam3.SAM
conns []*conn.Conn conns []*conn.Conn
datadir string datadir string
host string
port string
samhost string samhost string
samport string samport string
samopts []string samopts []string
} }
func (m Manager) Serve() error { func (m Manager) Serve() error {
server, err := socks5.New(conf)
if err != nil {
return err
}
if err := server.ListenAndServe("tcp", m.host+":"+m.port); err != nil {
return err
}
return nil return nil
} }
@ -76,6 +85,8 @@ func NewManagerFromOptions(opts ...func(*Manager) error) (*Manager, error) {
m.samhost = "127.0.0.1" m.samhost = "127.0.0.1"
m.samport = "7656" m.samport = "7656"
m.datadir = "./tunnels/" m.datadir = "./tunnels/"
m.host = "127.0.0.1"
m.port = "7950"
for _, o := range opts { for _, o := range opts {
if err := o(&m); err != nil { if err := o(&m); err != nil {
return nil, err return nil, err