gofmt
This commit is contained in:
parent
87e9f8152f
commit
7648733aaa
20
tlsserver.go
20
tlsserver.go
@ -2,10 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -14,17 +14,17 @@ import (
|
|||||||
var (
|
var (
|
||||||
cfile = flag.String("cert", "cert.pem", "Certificate file in PEM format")
|
cfile = flag.String("cert", "cert.pem", "Certificate file in PEM format")
|
||||||
kfile = flag.String("key", "key.pem", "Key file in PEM format")
|
kfile = flag.String("key", "key.pem", "Key file in PEM format")
|
||||||
port = flag.Int("port", 1234, "Port to bind to")
|
port = flag.Int("port", 1234, "Port to bind to")
|
||||||
uid = flag.Int("uid", -1, "UID to run under")
|
uid = flag.Int("uid", -1, "UID to run under")
|
||||||
gid = flag.Int("gid", -1, "GID to run under")
|
gid = flag.Int("gid", -1, "GID to run under")
|
||||||
args []string
|
args []string
|
||||||
nargs int
|
nargs int
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
args = flag.Args()
|
args = flag.Args()
|
||||||
nargs = flag.NArg()
|
nargs = flag.NArg()
|
||||||
if nargs < 1 {
|
if nargs < 1 {
|
||||||
fmt.Println("Usage: tlsserver [options] cmd [flags for cmd]")
|
fmt.Println("Usage: tlsserver [options] cmd [flags for cmd]")
|
||||||
@ -46,7 +46,7 @@ func main() {
|
|||||||
|
|
||||||
// start listening
|
// start listening
|
||||||
sport := fmt.Sprintf(":%d", *port)
|
sport := fmt.Sprintf(":%d", *port)
|
||||||
sock, err := tls.Listen("tcp", sport , tconf)
|
sock, err := tls.Listen("tcp", sport, tconf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("error with tcp-socket:", err)
|
fmt.Println("error with tcp-socket:", err)
|
||||||
os.Exit(3)
|
os.Exit(3)
|
||||||
@ -70,8 +70,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// accept-loop
|
// accept-loop
|
||||||
for {
|
for {
|
||||||
conn, err := sock.Accept()
|
conn, err := sock.Accept()
|
||||||
@ -105,7 +103,7 @@ func handleConnection(conn net.Conn) {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
return
|
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, "PATH="+os.Getenv("PATH"))
|
||||||
cmd.Env = append(cmd.Env, "PROTO=TCP")
|
cmd.Env = append(cmd.Env, "PROTO=TCP")
|
||||||
cmd.Env = append(cmd.Env, "TCPLOCALIP="+lh)
|
cmd.Env = append(cmd.Env, "TCPLOCALIP="+lh)
|
||||||
|
Loading…
Reference in New Issue
Block a user