Skip to content

Commit

Permalink
Rename -P to -W for consistency with SSH client
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedeer committed Oct 20, 2017
1 parent 77177d3 commit a2ad73a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The -L switch works (almost) the same way it does in SSH. For the uninitiated, -

Alternatively, SSH ProxyCommand mode works too:

ssh -o ProxyCommand='./tuntox -i <ToxID> -P localhost:22' gdr@localhost
ssh -o ProxyCommand='./tuntox -i <ToxID> -W localhost:22' gdr@localhost

Fun stuff: [VPN over Tox](VPN.md)

Expand Down
4 changes: 2 additions & 2 deletions VPN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ On the server (where tuntox is already running):

On the client:

socat -d -d TUN:10.20.30.40/24,up 'SYSTEM:./tuntox -P 127.0.0.1@9876 -i 86e70ffe9f835b12667d296f2df9c307ba1aff06'
socat -d -d TUN:10.20.30.40/24,up 'SYSTEM:./tuntox -W 127.0.0.1@9876 -i 86e70ffe9f835b12667d296f2df9c307ba1aff06'

Viola, you have a point-to-point VPN. On client:

Expand All @@ -28,7 +28,7 @@ Also: inefficient, insecure (requires PermitRootLogin yes on server).

On the client:

socat -d -d TUN:10.20.30.40/24,up 'SYSTEM:ssh root@localhost -o ProxyCommand=\"./tuntox -P "127.0.0.1:22" -d -i 86e70ffe9f835b12667d296f2df9c307ba1aff06\" socat -d -d - "TUN:10.20.30.41/24,up"'
socat -d -d TUN:10.20.30.40/24,up 'SYSTEM:ssh root@localhost -o ProxyCommand=\"./tuntox -W "127.0.0.1:22" -d -i 86e70ffe9f835b12667d296f2df9c307ba1aff06\" socat -d -d - "TUN:10.20.30.41/24,up"'

# ping 10.20.30.41
PING 10.20.30.41 (10.20.30.41) 56(84) bytes of data.
Expand Down
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ void help()
fprintf(stderr, " -i <toxid> - remote point Tox ID\n");
fprintf(stderr, " -L <localport>:<remotehostname>:<remoteport>\n");
fprintf(stderr, " - forward <remotehostname>:<remoteport> to 127.0.0.1:<localport>\n");
fprintf(stderr, " -P <remotehostname>:<remoteport> - forward <remotehostname>:<remoteport> to\n");
fprintf(stderr, " -W <remotehostname>:<remoteport> - forward <remotehostname>:<remoteport> to\n");
fprintf(stderr, " stdin/stdout (SSH ProxyCommand mode)\n");
fprintf(stderr, " -p - ping the server from -i and exit\n");
fprintf(stderr, " Common:\n");
Expand Down Expand Up @@ -1237,13 +1237,13 @@ int main(int argc, char *argv[])
}
log_printf(L_DEBUG, "Forwarding remote port %d to local port %d\n", remote_port, local_port);
break;
case 'P':
case 'W':
/* Pipe forwarding */
client_mode = 1;
client_pipe_mode = 1;
if(parse_pipe_port_forward(optarg, &remote_host, &remote_port) < 0)
{
log_printf(L_ERROR, "Invalid value for -P option - use something like -P 127.0.0.1:22\n");
log_printf(L_ERROR, "Invalid value for -W option - use something like -W 127.0.0.1:22\n");
exit(1);
}
if(min_log_level == L_UNSET)
Expand Down
4 changes: 2 additions & 2 deletions scripts/tokssh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ then
# last argument is user@toxid
user=${arruserhost[0]}
toxid=${arruserhost[1]}
ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p $secret" $args $user@localhost
ssh -o ProxyCommand="tuntox -i $toxid -W 127.0.0.1:%p $secret" $args $user@localhost
else
# last argument is just toxid
ssh -o ProxyCommand="tuntox -i $userhost -P 127.0.0.1:%p $secret" $args localhost
ssh -o ProxyCommand="tuntox -i $userhost -W 127.0.0.1:%p $secret" $args localhost
fi

2 changes: 1 addition & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int parse_local_port_forward(char *string, int *local_port, char **hostname, int
return 0;
}

/* Parse the -P parameter */
/* Parse the -W parameter */
/* 0 = success */
int parse_pipe_port_forward(char *string, char **hostname, int *remote_port)
{
Expand Down

0 comments on commit a2ad73a

Please sign in to comment.