Skip to content

Commit f0cfd48

Browse files
committed
Sockopt: Add addressPortStrategy
1 parent f5aea03 commit f0cfd48

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

web/assets/js/model/outbound.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ const MODE_OPTION = {
8686
STREAM_ONE: "stream-one",
8787
};
8888

89+
const Address_Port_Strategy = {
90+
NONE: "none",
91+
SrvPortOnly: "srvportonly",
92+
SrvAddressOnly: "srvaddressonly",
93+
SrvPortAndAddress: "srvportandaddress",
94+
TxtPortOnly: "txtportonly",
95+
TxtAddressOnly: "txtaddressonly",
96+
TxtPortAndAddress: "txtportandaddress"
97+
};
98+
8999
Object.freeze(Protocols);
90100
Object.freeze(SSMethods);
91101
Object.freeze(TLS_FLOW_CONTROL);
@@ -95,7 +105,7 @@ Object.freeze(OutboundDomainStrategies);
95105
Object.freeze(WireguardDomainStrategy);
96106
Object.freeze(USERS_SECURITY);
97107
Object.freeze(MODE_OPTION);
98-
108+
Object.freeze(Address_Port_Strategy);
99109

100110
class CommonClass {
101111

@@ -412,14 +422,16 @@ class SockoptStreamSettings extends CommonClass {
412422
tcpFastOpen = false,
413423
tcpKeepAliveInterval = 0,
414424
tcpMptcp = false,
415-
penetrate = false
425+
penetrate = false,
426+
addressPortStrategy = Address_Port_Strategy.NONE,
416427
) {
417428
super();
418429
this.dialerProxy = dialerProxy;
419430
this.tcpFastOpen = tcpFastOpen;
420431
this.tcpKeepAliveInterval = tcpKeepAliveInterval;
421432
this.tcpMptcp = tcpMptcp;
422433
this.penetrate = penetrate;
434+
this.addressPortStrategy = addressPortStrategy;
423435
}
424436

425437
static fromJson(json = {}) {
@@ -430,6 +442,7 @@ class SockoptStreamSettings extends CommonClass {
430442
json.tcpKeepAliveInterval,
431443
json.tcpMptcp,
432444
json.penetrate,
445+
json.addressPortStrategy
433446
);
434447
}
435448

@@ -440,6 +453,7 @@ class SockoptStreamSettings extends CommonClass {
440453
tcpKeepAliveInterval: this.tcpKeepAliveInterval,
441454
tcpMptcp: this.tcpMptcp,
442455
penetrate: this.penetrate,
456+
addressPortStrategy: this.addressPortStrategy
443457
};
444458
}
445459
}

web/html/xui/form/outbound.html

+7-2
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,17 @@
465465
<a-select-option v-for="tag in ['', ...outModal.tags]" :value="tag">[[ tag ]]</a-select-option>
466466
</a-select>
467467
</a-form-item>
468-
<a-form-item label="TCP Fast Open">
469-
<a-switch v-model="outbound.stream.sockopt.tcpFastOpen"></a-switch>
468+
<a-form-item label='Address Port Strategy'>
469+
<a-select v-model="outbound.stream.sockopt.addressPortStrategy" :dropdown-class-name="themeSwitcher.currentTheme">
470+
<a-select-option v-for="key in Address_Port_Strategy" :value="key">[[ key ]]</a-select-option>
471+
</a-select>
470472
</a-form-item>
471473
<a-form-item label="Keep Alive Interval">
472474
<a-input-number v-model.number="outbound.stream.sockopt.tcpKeepAliveInterval" :min="0"></a-input-number>
473475
</a-form-item>
476+
<a-form-item label="TCP Fast Open">
477+
<a-switch v-model="outbound.stream.sockopt.tcpFastOpen"></a-switch>
478+
</a-form-item>
474479
<a-form-item label="Multipath TCP">
475480
<a-switch v-model.trim="outbound.stream.sockopt.tcpMptcp"></a-switch>
476481
</a-form-item>

0 commit comments

Comments
 (0)