route/cmd/route-httpagent/main.go

41 lines
844 B
Go

package main
import (
"crypto/tls"
"flag"
"os"
"git.xeserv.us/xena/route/lib/tun2"
"github.com/Xe/ln"
)
var (
token = flag.String("token", "", "Service identifier token")
domain = flag.String("domain", "", "Domain to ID as")
backend = flag.String("backend", "http://127.0.0.1:9090", "backend TCP/HTTP server")
serverAddr = flag.String("server", "127.0.0.1:9234", "frontend server")
connMethod = flag.String("method", "tcp", "tcp or kcp connections?")
)
func main() {
flag.Parse()
cfg := &tun2.ClientConfig{
TLSConfig: &tls.Config{},
ConnType: *connMethod,
ServerAddr: *serverAddr,
Token: *token,
Domain: *domain,
BackendURL: *backend,
}
client, _ := tun2.NewClient(cfg)
err := client.Connect()
if err != nil {
ln.Error(err, ln.F{
"action": "client_running",
})
os.Exit(1)
}
}