Ejemplo n.º 1
0
func main() {
	flag.Parse()
	log.Info("start app, Read From[%s], forward data To[%s], auth[%s] log-level[%s].",
		_LocalNetworkHost, _ForwardServer, _AuthUserPassword, _LogLevel)

	log.SetLevelByName(_LogLevel)

	if _ForwardTHread < MIN_THREAD {
		_ForwardTHread = MIN_THREAD
	}

	conf := &cli.Config{
		LocalHostServ: _LocalNetworkHost,
		WebsocketAuth: _AuthUserPassword,
		MaxThread:     _ForwardTHread,
	}
	const (
		default_sleep_time = 10 * time.Second
	)
	for {
		cli.Connect2Serv(_ForwardServer, conf)
		if stop {
			break
		} else {
			log.Info("Connect2Serv fail, wait[%s]Second.", default_sleep_time)
			time.Sleep(default_sleep_time)
		}
	}
	log.Info("------------------- main end ------------------------")
}
Ejemplo n.º 2
0
func main() {
	flag.Parse()

	log.Info("app start forward[%s] websocket[%s] auth[%s] log-level[%s], ",
		_ForwardListtion, _Websocketlisten, _AuthUserPassword, _LogLevel)

	log.SetLevelByName(_LogLevel)

	var conf = &svr.Config{Auth: _AuthUserPassword}

	svr.ListenIPForwardAndWebsocketServ(_ForwardListtion, _Websocketlisten, conf)
}