// main.go package main import ( "flag" "fmt" "github.com/TransX/cli" "github.com/TransX/log" "github.com/TransX/protocol" // "github.com/davecheney/profile" "net/http" _ "net/http/pprof" "strconv" ) func tunnel() { trans := protocol.NewTransTCP() log.Info("%s side is encrypted.", cli.EncryptSide) if cli.DestPort != 0 { log.Info("Listening on 0.0.0.0:%d. Forward %s:%d", cli.ListenPort, cli.DestIP, cli.DestPort) trans.Start(strconv.Itoa(cli.ListenPort), cli.DestIP, strconv.Itoa(cli.DestPort), cli.EncryptSide) } else { trans.Start("1200", "192.168.0.120", "8118", "client") } } func main() { // defer profile.Start(profile.CPUProfile).Stop() flag.Parse() fmt.Println("Hello World!") log.LogTo(cli.LogTo, "INFO") if cli.ProfilePort != 0 { go func() { http.ListenAndServe("0.0.0.0:"+strconv.Itoa(cli.ProfilePort), nil) }() } tunnel() }