wg: rename 'bandwidth' to 'transfer' in output
'bandwidth' is a measure of speed, but wg's output shows only the number of bytes transferred. Thus 'transfer' is a better label. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
f4cf3ae124
commit
f3a1f15186
|
@ -203,7 +203,7 @@ static char *bytes(uint64_t b)
|
||||||
static const char *COMMAND_NAME = NULL;
|
static const char *COMMAND_NAME = NULL;
|
||||||
static void show_usage(void)
|
static void show_usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s %s { <interface> | all | interfaces } [public-key | private-key | preshared-key | listen-port | peers | endpoints | allowed-ips | latest-handshakes | bandwidth | persistent-keepalive]\n", PROG_NAME, COMMAND_NAME);
|
fprintf(stderr, "Usage: %s %s { <interface> | all | interfaces } [public-key | private-key | preshared-key | listen-port | peers | endpoints | allowed-ips | latest-handshakes | transfer | persistent-keepalive]\n", PROG_NAME, COMMAND_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pretty_print(struct wgdevice *device)
|
static void pretty_print(struct wgdevice *device)
|
||||||
|
@ -239,7 +239,7 @@ static void pretty_print(struct wgdevice *device)
|
||||||
if (peer->last_handshake_time.tv_sec)
|
if (peer->last_handshake_time.tv_sec)
|
||||||
terminal_printf(" " TERMINAL_BOLD "latest handshake" TERMINAL_RESET ": %s\n", ago(&peer->last_handshake_time));
|
terminal_printf(" " TERMINAL_BOLD "latest handshake" TERMINAL_RESET ": %s\n", ago(&peer->last_handshake_time));
|
||||||
if (peer->rx_bytes || peer->tx_bytes) {
|
if (peer->rx_bytes || peer->tx_bytes) {
|
||||||
terminal_printf(" " TERMINAL_BOLD "bandwidth" TERMINAL_RESET ": ");
|
terminal_printf(" " TERMINAL_BOLD "transfer" TERMINAL_RESET ": ");
|
||||||
terminal_printf("%s received, ", bytes(peer->rx_bytes));
|
terminal_printf("%s received, ", bytes(peer->rx_bytes));
|
||||||
terminal_printf("%s sent\n", bytes(peer->tx_bytes));
|
terminal_printf("%s sent\n", bytes(peer->tx_bytes));
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int
|
||||||
printf("%s\t", device->interface);
|
printf("%s\t", device->interface);
|
||||||
printf("%s\t%llu\n", key(peer->public_key), (unsigned long long)peer->last_handshake_time.tv_sec);
|
printf("%s\t%llu\n", key(peer->public_key), (unsigned long long)peer->last_handshake_time.tv_sec);
|
||||||
}
|
}
|
||||||
} else if (!strcmp(param, "bandwidth")) {
|
} else if (!strcmp(param, "transfer")) {
|
||||||
for_each_wgpeer(device, peer, i) {
|
for_each_wgpeer(device, peer, i) {
|
||||||
if (with_interface)
|
if (with_interface)
|
||||||
printf("%s\t", device->interface);
|
printf("%s\t", device->interface);
|
||||||
|
|
2
src/wg.8
2
src/wg.8
|
@ -36,7 +36,7 @@ Sub-commands that take an INTERFACE must be passed a WireGuard interface.
|
||||||
.SH COMMANDS
|
.SH COMMANDS
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBshow\fP { \fI<interface>\fP | \fIall\fP | \fIinterfaces\fP } [\fIpublic-key\fP | \fIprivate-key\fP | \fIpreshared-key\fP | \fIlisten-port\fP | \fIpeers\fP | \fIendpoints\fP | \fIallowed-ips\fP | \fIlatest-handshakes\fP | \fIpersistent-keepalive\fP | \fIbandwidth\fP]
|
\fBshow\fP { \fI<interface>\fP | \fIall\fP | \fIinterfaces\fP } [\fIpublic-key\fP | \fIprivate-key\fP | \fIpreshared-key\fP | \fIlisten-port\fP | \fIpeers\fP | \fIendpoints\fP | \fIallowed-ips\fP | \fIlatest-handshakes\fP | \fIpersistent-keepalive\fP | \fItransfer\fP]
|
||||||
Shows current WireGuard configuration of specified \fI<interface>\fP.
|
Shows current WireGuard configuration of specified \fI<interface>\fP.
|
||||||
If no \fI<interface>\fP is specified, \fI<interface>\fP defaults to \fIall\fP.
|
If no \fI<interface>\fP is specified, \fI<interface>\fP defaults to \fIall\fP.
|
||||||
If \fIinterfaces\fP is specified, prints a list of all WireGuard interfaces,
|
If \fIinterfaces\fP is specified, prints a list of all WireGuard interfaces,
|
||||||
|
|
Loading…
Reference in New Issue