|
|
@ -16,7 +16,7 @@ var dialTimeout, udpTimeout int64
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
CmdNetforward.Flags().IntVarP(&f.DelayToward, "delay-toward", "T", 0, "delay toward milliseconds,0 for both,1 for local,2 for remote")
|
|
|
|
CmdNetforward.Flags().IntVarP(&f.DelayToward, "delay-toward", "T", 0, "delay toward milliseconds,0 for both,1 for local,2 for remote")
|
|
|
|
CmdNetforward.Flags().BoolVarP(&f.StdinMode, "stdin", "s", false, "enable stdin mode")
|
|
|
|
CmdNetforward.Flags().BoolVarP(&f.StdinMode, "stdin", "s", false, "enable stdin mode")
|
|
|
|
CmdNetforward.Flags().IntVarP(&f.DelayMilSec, "delay", "D", 0, "delay milliseconds")
|
|
|
|
CmdNetforward.Flags().IntVarP(&f.DelayMilSec, "delay", "S", 0, "delay milliseconds")
|
|
|
|
CmdNetforward.Flags().StringVarP(&f.LocalAddr, "local", "l", "0.0.0.0", "bind address")
|
|
|
|
CmdNetforward.Flags().StringVarP(&f.LocalAddr, "local", "l", "0.0.0.0", "bind address")
|
|
|
|
CmdNetforward.Flags().IntVarP(&f.LocalPort, "port", "p", 11270, "local listen port")
|
|
|
|
CmdNetforward.Flags().IntVarP(&f.LocalPort, "port", "p", 11270, "local listen port")
|
|
|
|
CmdNetforward.Flags().BoolVarP(&f.EnableTCP, "enable-tcp-forward", "t", true, "enable tcp forward mode")
|
|
|
|
CmdNetforward.Flags().BoolVarP(&f.EnableTCP, "enable-tcp-forward", "t", true, "enable tcp forward mode")
|
|
|
@ -47,6 +47,7 @@ var CmdNetforward = &cobra.Command{
|
|
|
|
starlog.Errorln("run net forward failed:", err)
|
|
|
|
starlog.Errorln("run net forward failed:", err)
|
|
|
|
os.Exit(2)
|
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(time.Millisecond * 500)
|
|
|
|
sign := make(chan os.Signal)
|
|
|
|
sign := make(chan os.Signal)
|
|
|
|
signal.Notify(sign, os.Interrupt, os.Kill)
|
|
|
|
signal.Notify(sign, os.Interrupt, os.Kill)
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|