Handle missing arguments

This commit is contained in:
bluepython508
2023-11-28 22:20:02 +00:00
parent 170fff4851
commit 6f06d76797

View File

@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"net" "net"
"os"
"github.com/goburrow/netforward" "github.com/goburrow/netforward"
"tailscale.com/tsnet" "tailscale.com/tsnet"
@@ -26,6 +27,11 @@ func (dialer Dialer) Dial() (net.Conn, error) {
func main() { func main() {
flag.Parse() flag.Parse()
if !(host_proto != "" && hostname != "" && host_port != "" && dst_proto != "" && dst_addr != "") {
fmt.Println("Usage: tsnet-proxy PROTO HOSTNAME PORT DST-PROTO DST")
fmt.Println("Where PROTO is one of tcp, udp, unix")
os.Exit(1)
}
s := &tsnet.Server{ s := &tsnet.Server{
Hostname: hostname, Hostname: hostname,