30 lines
598 B
Go
30 lines
598 B
Go
// main.go
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"github.com/TransX/cli"
|
|
"github.com/TransX/log"
|
|
"strconv"
|
|
)
|
|
|
|
func tunnel() {
|
|
trans := 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() {
|
|
flag.Parse()
|
|
fmt.Println("Hello World!")
|
|
log.LogTo(cli.LogTo, "INFO")
|
|
tunnel()
|
|
}
|