-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (27 loc) · 903 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"flag"
"fmt"
"sshbypass/server"
"sshbypass/client"
)
func main() {
// parse flag mode from args
mode := flag.String("mode", "", "specify the mode, if server or client mode")
sshIp := flag.String("ssh-ip", "127.0.0.1", "specify the ip of the ssh server ")
sshPort := flag.String("ssh-port", "22", "specify the port of the ssh server")
ip := flag.String("ip", "0.0.0.0", "specify the ip of the server wrapper ")
port := flag.String("port", "8080", "specify the port of the server wrapper ")
path := flag.String("path", "ssh", "specify the path ")
flag.Parse()
// check if mode is server or client
if *mode == "server" {
fmt.Println("server mode")
server.Serve(*sshIp, *sshPort, *ip, *port, *path)
} else if *mode == "client" {
fmt.Println("client mode")
client.Serve(*sshIp, *sshPort, *ip, *port, *path)
} else {
panic(fmt.Errorf("invalid mode"))
}
}