Skip to content

Commit

Permalink
wireguard - noKernelTun
Browse files Browse the repository at this point in the history
  • Loading branch information
MHSanaei committed Oct 20, 2024
1 parent 07bf741 commit bebf83f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 deletions.
12 changes: 4 additions & 8 deletions web/assets/js/model/outbound.js
Original file line number Diff line number Diff line change
Expand Up @@ -1182,8 +1182,7 @@ Outbound.WireguardSettings = class extends CommonClass {
domainStrategy = '',
reserved = '',
peers = [new Outbound.WireguardSettings.Peer()],
kernelMode = false,
kernelTun = false
noKernelTun = false,
) {
super();
this.mtu = mtu;
Expand All @@ -1194,8 +1193,7 @@ Outbound.WireguardSettings = class extends CommonClass {
this.domainStrategy = domainStrategy;
this.reserved = Array.isArray(reserved) ? reserved.join(',') : reserved;
this.peers = peers;
this.kernelMode = kernelMode;
this.kernelTun = kernelTun;
this.noKernelTun = noKernelTun;
}

addPeer() {
Expand All @@ -1215,8 +1213,7 @@ Outbound.WireguardSettings = class extends CommonClass {
json.domainStrategy,
json.reserved,
json.peers.map(peer => Outbound.WireguardSettings.Peer.fromJson(peer)),
json.kernelMode,
json.kernelTun,
json.noKernelTun,
);
}

Expand All @@ -1229,8 +1226,7 @@ Outbound.WireguardSettings = class extends CommonClass {
domainStrategy: WireguardDomainStrategy.includes(this.domainStrategy) ? this.domainStrategy : undefined,
reserved: this.reserved ? this.reserved.split(",").map(Number) : undefined,
peers: Outbound.WireguardSettings.Peer.toJsonArray(this.peers),
kernelMode: this.kernelMode,
kernelTun: this.kernelTun,
noKernelTun: this.noKernelTun,
};
}
};
Expand Down
12 changes: 4 additions & 8 deletions web/assets/js/model/xray.js
Original file line number Diff line number Diff line change
Expand Up @@ -2651,16 +2651,14 @@ Inbound.WireguardSettings = class extends XrayCommonClass {
mtu = 1420,
secretKey = Wireguard.generateKeypair().privateKey,
peers = [new Inbound.WireguardSettings.Peer()],
kernelMode = false,
kernelTun = false,
noKernelTun = false
) {
super(protocol);
this.mtu = mtu;
this.secretKey = secretKey;
this.pubKey = secretKey.length > 0 ? Wireguard.generateKeypair(secretKey).publicKey : '';
this.peers = peers;
this.kernelMode = kernelMode;
this.kernelTun = kernelTun;
this.noKernelTun = noKernelTun;
}

addPeer() {
Expand All @@ -2677,8 +2675,7 @@ Inbound.WireguardSettings = class extends XrayCommonClass {
json.mtu,
json.secretKey,
json.peers.map(peer => Inbound.WireguardSettings.Peer.fromJson(peer)),
json.kernelMode,
json.kernelTun,
json.noKernelTun,
);
}

Expand All @@ -2687,8 +2684,7 @@ Inbound.WireguardSettings = class extends XrayCommonClass {
mtu: this.mtu ?? undefined,
secretKey: this.secretKey,
peers: Inbound.WireguardSettings.Peer.toJsonArray(this.peers),
kernelMode: this.kernelMode,
kernelTun: this.kernelTun,
noKernelTun: this.noKernelTun,
};
}
};
Expand Down
7 changes: 2 additions & 5 deletions web/html/xui/form/outbound.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,8 @@
<a-form-item label='Workers'>
<a-input-number v-model.number="outbound.settings.workers" min="0"></a-input-number>
</a-form-item>
<a-form-item label='Kernel Mode'>
<a-switch v-model="outbound.settings.kernelMode"></a-switch>
</a-form-item>
<a-form-item label='Kernel Tun'>
<a-switch v-model="outbound.settings.kernelTun"></a-switch>
<a-form-item label='No Kernel Tun'>
<a-switch v-model="outbound.settings.noKernelTun"></a-switch>
</a-form-item>
<a-form-item>
<template slot="label">
Expand Down
7 changes: 2 additions & 5 deletions web/html/xui/form/protocol/wireguard.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
<a-form-item label='MTU'>
<a-input-number v-model.number="inbound.settings.mtu"></a-input-number>
</a-form-item>
<a-form-item label='Kernel Mode'>
<a-switch v-model="inbound.settings.kernelMode"></a-switch>
</a-form-item>
<a-form-item label='Kernel Tun'>
<a-switch v-model="inbound.settings.kernelTun"></a-switch>
<a-form-item label='No Kernel Tun'>
<a-switch v-model="inbound.settings.noKernelTun"></a-switch>
</a-form-item>
<a-form-item label="Peers">
<a-button icon="plus" type="primary" size="small" @click="inbound.settings.addPeer()"></a-button>
Expand Down
8 changes: 2 additions & 6 deletions web/html/xui/inbound_info_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,8 @@
<td>[[ inbound.settings.mtu ]]</td>
</tr>
<tr>
<td>Kernel Mode</td>
<td>[[ inbound.settings.kernelMode ]]</td>
</tr>
<tr>
<td>Kernel Tun</td>
<td>[[ inbound.settings.kernelTun ]]</td>
<td>No Kernel Tun</td>
<td>[[ inbound.settings.noKernelTun ]]</td>
</tr>
<template v-for="(peer, index) in inbound.settings.peers">
<tr>
Expand Down
3 changes: 1 addition & 2 deletions web/html/xui/warp_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@
publicKey: peer.public_key,
endpoint: peer.endpoint.host,
}],
kernelMode: false,
kernelTun: false,
noKernelTun: false,
}
});
}
Expand Down

0 comments on commit bebf83f

Please sign in to comment.