diff --git a/tlsserver.go b/tlsserver.go index 9d3806d..09618b4 100644 --- a/tlsserver.go +++ b/tlsserver.go @@ -2,10 +2,10 @@ package main import ( "crypto/tls" - "log" - "net" "flag" "fmt" + "log" + "net" "os" "os/exec" "syscall" @@ -14,17 +14,17 @@ import ( var ( cfile = flag.String("cert", "cert.pem", "Certificate file in PEM format") kfile = flag.String("key", "key.pem", "Key file in PEM format") - port = flag.Int("port", 1234, "Port to bind to") - uid = flag.Int("uid", -1, "UID to run under") - gid = flag.Int("gid", -1, "GID to run under") - args []string + port = flag.Int("port", 1234, "Port to bind to") + uid = flag.Int("uid", -1, "UID to run under") + gid = flag.Int("gid", -1, "GID to run under") + args []string nargs int ) func main() { flag.Parse() - args = flag.Args() + args = flag.Args() nargs = flag.NArg() if nargs < 1 { fmt.Println("Usage: tlsserver [options] cmd [flags for cmd]") @@ -46,7 +46,7 @@ func main() { // start listening sport := fmt.Sprintf(":%d", *port) - sock, err := tls.Listen("tcp", sport , tconf) + sock, err := tls.Listen("tcp", sport, tconf) if err != nil { fmt.Println("error with tcp-socket:", err) os.Exit(3) @@ -70,8 +70,6 @@ func main() { } } - - // accept-loop for { conn, err := sock.Accept() @@ -105,7 +103,7 @@ func handleConnection(conn net.Conn) { log.Println(err) return } - cmd.Env = make([]string,0) + cmd.Env = make([]string, 0) cmd.Env = append(cmd.Env, "PATH="+os.Getenv("PATH")) cmd.Env = append(cmd.Env, "PROTO=TCP") cmd.Env = append(cmd.Env, "TCPLOCALIP="+lh)