You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/cmd/add.go
+8-11Lines changed: 8 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,17 @@ import (
7
7
)
8
8
9
9
typeaddCmdConfigstruct {
10
-
endpointstring
11
-
outboundbool
12
-
keepaliveint
10
+
endpointstring
11
+
outboundEndpointstring
12
+
keepaliveint
13
13
}
14
14
15
15
// Defaults for add command.
16
16
// See root command for shared defaults.
17
17
varaddCmdArgs=addCmdConfig{
18
-
endpoint: Endpoint,
19
-
outbound: false,
20
-
keepalive: Keepalive,
18
+
endpoint: Endpoint,
19
+
outboundEndpoint: Endpoint,
20
+
keepalive: Keepalive,
21
21
}
22
22
23
23
// addCmd represents the add command.
@@ -31,14 +31,11 @@ var addCmd = &cobra.Command{
31
31
funcinit() {
32
32
rootCmd.AddCommand(addCmd)
33
33
34
-
addCmd.PersistentFlags().StringVarP(&addCmdArgs.endpoint, "endpoint", "e", addCmdArgs.endpoint, "[REQUIRED] socket address of wireguard listener; client address if inbound handshake and server address if outbound (example \"1.2.3.4:51820\")")
35
-
addCmd.PersistentFlags().BoolVar(&addCmdArgs.outbound, "outbound", addCmdArgs.outbound, "use endpoint to initiate handshake out to server instead of the other way around")
34
+
addCmd.PersistentFlags().StringVarP(&addCmdArgs.endpoint, "endpoint", "e", addCmdArgs.endpoint, "IP:PORT (or [IP]:PORT for IPv6) of wireguard listener that server will connect to (example \"1.2.3.4:51820\")")
35
+
addCmd.PersistentFlags().StringVarP(&addCmdArgs.outboundEndpoint, "outbound-endpoint", "o", addCmdArgs.outboundEndpoint, "IP:PORT (or [IP]:PORT for IPv6) of wireguard listener that client will connect to (example \"4.3.2.1:51820\"")
36
36
37
37
addCmd.PersistentFlags().IntVarP(&addCmdArgs.keepalive, "keepalive", "k", addCmdArgs.keepalive, "tunnel keepalive in seconds")
Copy file name to clipboardExpand all lines: src/cmd/add_client.go
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -51,17 +51,17 @@ func init() {
51
51
addCmd.AddCommand(addClientCmd)
52
52
53
53
addClientCmd.Flags().StringVarP(&addClientCmdArgs.serverAddress, "server-address", "s", addClientCmdArgs.serverAddress, "API address of server that new client will connect to. By default new clients connect to existing relay servers")
54
-
addClientCmd.Flags().IntVarP(&addClientCmdArgs.port, "port", "p", addClientCmdArgs.port, "port of wireguard listener to start; server port if --outbound, client port otherwise. Default is the port specified in --endpoint")
54
+
addClientCmd.Flags().IntVarP(&addClientCmdArgs.port, "port", "p", addClientCmdArgs.port, "port of wireguard listener to start; server port if --outbound-endpoint, client port otherwise. Default is the port specified in --endpoint")
Copy file name to clipboardExpand all lines: src/cmd/add_server.go
+17-21Lines changed: 17 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ func init() {
56
56
57
57
addServerCmd.Flags().StringSliceVarP(&addServerCmdArgs.allowedIPs, "routes", "r", addServerCmdArgs.allowedIPs, "[REQUIRED] CIDR IP ranges that will be routed through wiretap")
58
58
addServerCmd.Flags().StringVarP(&addServerCmdArgs.serverAddress, "server-address", "s", addServerCmdArgs.serverAddress, "API address of server that new server will connect to, connects to client by default")
59
-
addServerCmd.Flags().IntVarP(&addServerCmdArgs.port, "port", "p", addServerCmdArgs.port, "listener port to start on new server for wireguard relay. If --outbound, default is the port specified in --endpoint; otherwise default is 51820")
59
+
addServerCmd.Flags().IntVarP(&addServerCmdArgs.port, "port", "p", addServerCmdArgs.port, "listener port to start on new server for wireguard relay. If --outbound-endpoint, default is the port specified in --outbound-endpoint; otherwise default is 51820")
60
60
addServerCmd.Flags().StringVarP(&addServerCmdArgs.nickname, "nickname", "n", addServerCmdArgs.nickname, "Server nickname to display in 'status' command")
61
61
addServerCmd.Flags().StringVarP(&addServerCmdArgs.localhostIP, "localhost-ip", "i", addServerCmdArgs.localhostIP, "[EXPERIMENTAL] Redirect wiretap packets destined for this IPv4 address to server's localhost")
62
62
addServerCmd.Flags().BoolVarP(&addServerCmdArgs.writeToClipboard, "clipboard", "c", addServerCmdArgs.writeToClipboard, "copy configuration args to clipboard")
Copy file name to clipboardExpand all lines: src/cmd/configure.go
+39-28Lines changed: 39 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
package cmd
2
2
3
3
import (
4
+
"errors"
4
5
"fmt"
5
6
"net"
6
7
"net/netip"
@@ -16,8 +17,9 @@ import (
16
17
typeconfigureCmdConfigstruct {
17
18
allowedIPs []string
18
19
endpointstring
19
-
outboundbool
20
+
outboundEndpointstring
20
21
portint
22
+
sportint
21
23
nicknamestring
22
24
configFileRelaystring
23
25
configFileE2EEstring
@@ -43,8 +45,9 @@ type configureCmdConfig struct {
43
45
varconfigureCmdArgs=configureCmdConfig{
44
46
allowedIPs: []string{""},
45
47
endpoint: Endpoint,
46
-
outbound: false,
48
+
outboundEndpoint: Endpoint,
47
49
port: USE_ENDPOINT_PORT,
50
+
sport: USE_ENDPOINT_PORT,
48
51
nickname: "",
49
52
configFileRelay: ConfigRelay,
50
53
configFileE2EE: ConfigE2EE,
@@ -80,9 +83,10 @@ func init() {
80
83
rootCmd.AddCommand(configureCmd)
81
84
82
85
configureCmd.Flags().StringSliceVarP(&configureCmdArgs.allowedIPs, "routes", "r", configureCmdArgs.allowedIPs, "[REQUIRED] CIDR IP ranges that will be routed through wiretap (example \"10.0.0.1/24\")")
83
-
configureCmd.Flags().StringVarP(&configureCmdArgs.endpoint, "endpoint", "e", configureCmdArgs.endpoint, "[REQUIRED] IP:PORT (or [IP]:PORT for IPv6) of wireguard listener that server will connect to (example \"1.2.3.4:51820\")")
84
-
configureCmd.Flags().BoolVar(&configureCmdArgs.outbound, "outbound", configureCmdArgs.outbound, "client will initiate handshake to server; --endpoint now specifies server's listening socket instead of client's, and --port assigns the server's listening port instead of client's")
85
-
configureCmd.Flags().IntVarP(&configureCmdArgs.port, "port", "p", configureCmdArgs.port, "listener port for wireguard relay. Default is to copy the --endpoint port. If --outbound, sets port for the server; else for the client.")
86
+
configureCmd.Flags().StringVarP(&configureCmdArgs.endpoint, "endpoint", "e", configureCmdArgs.endpoint, "IP:PORT (or [IP]:PORT for IPv6) of wireguard listener that server will connect to (example \"1.2.3.4:51820\")")
87
+
configureCmd.Flags().StringVarP(&configureCmdArgs.outboundEndpoint, "outbound-endpoint", "o", configureCmdArgs.outboundEndpoint, "IP:PORT (or [IP]:PORT for IPv6) of wireguard listener that client will connect to (example \"4.3.2.1:51820\"")
88
+
configureCmd.Flags().IntVarP(&configureCmdArgs.port, "port", "p", configureCmdArgs.port, "listener port for client wireguard relay. Default is to copy the --endpoint port, or fallback to 51820")
89
+
configureCmd.Flags().IntVarP(&configureCmdArgs.sport, "sport", "S", configureCmdArgs.sport, "listener port for server wireguard relay. Default is to copy the --outbound-endpoint port, or fallback to 51820")
86
90
configureCmd.Flags().StringVarP(&configureCmdArgs.nickname, "nickname", "n", configureCmdArgs.nickname, "Server nickname to display in 'status' command")
87
91
configureCmd.Flags().StringVarP(&configureCmdArgs.localhostIP, "localhost-ip", "i", configureCmdArgs.localhostIP, "[EXPERIMENTAL] Redirect wiretap packets destined for this IPv4 address to server's localhost")
0 commit comments