Skip to content

Commit 3b4ae01

Browse files
feat: fully implement WireGuardTunnel 'descr' field #705
1 parent e392334 commit 3b4ae01

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/WireGuardTunnel.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ class WireGuardTunnel extends Model {
5151
indicates_false: 'no',
5252
help_text: 'Enables or disables this tunnels and any associated peers.',
5353
);
54+
$this->descr = new StringField(
55+
required: false,
56+
default: '',
57+
help_text: 'A description for this WireGuard tunnel.',
58+
);
5459
$this->listenport = new PortField(
5560
unique: true,
5661
default: '51820',

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APIModelsWireGuardTunnelTestCase.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class APIModelsWireGuardTunnelTestCase extends TestCase {
124124
$tunnel = new WireGuardTunnel(
125125
privatekey: 'KG0BA4UyPilHH5qnXCfr6Lw8ynecOPor88tljLy3AHk=',
126126
listenport: '55000',
127+
descr: 'test',
127128
async: false,
128129
);
129130
$tunnel->create(apply: true);
@@ -134,6 +135,7 @@ class APIModelsWireGuardTunnelTestCase extends TestCase {
134135
$this->assert_str_contains($wg_showconf->output, 'ListenPort = ' . $tunnel->listenport->value);
135136
$this->assert_str_contains($wg_showconf->output, 'PrivateKey = ' . $tunnel->privatekey->value);
136137
$this->assert_str_contains($wg_show->output, 'public key: ' . $tunnel->publickey->value);
138+
$this->assert_equals($tunnel->descr->value, 'test');
137139

138140
# Update the tunnel with new values
139141
$tunnel->from_representation(privatekey: 'GNdQw+ujEIVgys4B2dDCXcBpiiQsNd2bAq5hnTp+smg=', listenport: '51820');

0 commit comments

Comments
 (0)