Skip to content

Commit 481ed76

Browse files
committed
feat: define constants
1 parent 17cf2ee commit 481ed76

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/config/constants.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export const WIREGUARD_COMMANDS = {
2+
ADD_PEER: (comment: string, allowedAddress: string, key: string) =>
3+
`/interface wireguard peers add comment="${comment}" allowed-address=${allowedAddress} interface=wg0 public-key="${key}"`,
4+
REMOVE_PEER: (key: string) => `/interface wireguard peers remove [find public-key="${key}"]`,
5+
LIST_PEERS: `/interface wireguard peers print`,
6+
GET_INTERFACE_INFO: `/interface wireguard print`,
7+
};
8+
9+
export const WIREGUARD_FIELDS = {
10+
LISTEN_PORT: 'listen-port=',
11+
PUBLIC_KEY: 'public-key='
12+
}
13+
14+
export const CLIENT_ADD_SUCCESS = 'VPN client added successfully';
15+
16+
export const CLIENT_REMOVE_SUCCESS = 'VPN client removed successfully';
17+
18+
export const CLIENT_ADD_FAILED = 'VPN client added failed';
19+
20+
export const CLIENT_REMOVE_FAILED = 'VPN client removal failed';
21+
22+
export const LIST_CLIENTS_ERROR = 'Error listing VPN clients';
23+
24+
export const PARSE_LISTEN_PORT_ERROR = 'Failed to retrieve listen-port from the WireGuard interface output';
25+
26+
export const PARSE_PUBLIC_KEY_ERROR = 'Failed to retrieve public-key from the WireGuard interface output';
27+
28+
export const NO_CLIENTS_FOUND = "No valid IP addresses found from the clients.";

0 commit comments

Comments
 (0)