-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathazuminodelay.go
39 lines (34 loc) · 900 Bytes
/
azuminodelay.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
33
34
35
36
37
38
39
package main
import (
"fmt"
"os"
"strconv"
"github.com/Azumi67/PortforwardSec/nodelay"
)
func main() {
if len(os.Args) != 8 {
fmt.Printf("Usage: %s iranIP iranPort remoteIP remotePort protocol [tcpnodelay] true or false buffersize\n", os.Args[0])
return
}
iranIP := os.Args[1]
localPort := os.Args[2]
remoteIP := os.Args[3]
remotePort := os.Args[4]
protocol := os.Args[5]
noNagle, err := strconv.ParseBool(os.Args[6])
if err != nil {
fmt.Println("Invalid input for tcpnodelay. Enter true or false.")
return
}
bufferSize, err := strconv.Atoi(os.Args[7])
if err != nil {
fmt.Println("Invalid input for buffersize. example: 65535.")
return
}
switch protocol {
case "tcp":
nodelay.PortForwardTCP(iranIP, localPort, remoteIP, remotePort, noNagle, bufferSize)
default:
fmt.Println("Invalid protocol. Supported protocols are tcp and udp. More methods coming!")
}
}