2015-10-08 20:40:36 +08:00
|
|
|
// main.go
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2015-10-17 23:14:43 +08:00
|
|
|
"flag"
|
2015-10-08 20:40:36 +08:00
|
|
|
"fmt"
|
2015-10-17 23:14:43 +08:00
|
|
|
"github.com/TransX/cli"
|
2015-10-16 23:21:38 +08:00
|
|
|
"github.com/TransX/log"
|
2015-10-17 23:14:43 +08:00
|
|
|
"strconv"
|
2015-10-08 20:40:36 +08:00
|
|
|
)
|
|
|
|
|
|
2015-10-17 23:14:43 +08:00
|
|
|
func tunnel() {
|
2015-10-10 18:28:19 +08:00
|
|
|
trans := NewTransTCP()
|
2015-10-17 23:14:43 +08:00
|
|
|
if cli.DestPort != 0 {
|
|
|
|
|
log.Info("Listening on 127.0.0.1:%d. Forward %s:%d",cli.ListenPort, cli.DestIP, cli.DestPort)
|
|
|
|
|
trans.Start(strconv.Itoa(cli.ListenPort), cli.DestIP, strconv.Itoa(cli.DestPort))
|
|
|
|
|
} else {
|
|
|
|
|
trans.Start("1200", "192.168.0.120", "8118")
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-10 18:28:19 +08:00
|
|
|
}
|
|
|
|
|
|
2015-10-08 20:40:36 +08:00
|
|
|
func main() {
|
|
|
|
|
fmt.Println("Hello World!")
|
2015-10-17 23:14:43 +08:00
|
|
|
log.LogTo("stdout", "INFO")
|
|
|
|
|
flag.Parse()
|
|
|
|
|
tunnel()
|
2015-10-08 20:40:36 +08:00
|
|
|
}
|