mirror of
				https://github.com/MHSanaei/3x-ui.git
				synced 2025-11-04 14:22:51 +00:00 
			
		
		
		
	new - sockopt : all features #2293
This commit is contained in:
		
							parent
							
								
									d070a82b3d
								
							
						
					
					
						commit
						80cd793154
					
				
					 2 changed files with 113 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -90,6 +90,25 @@ const USAGE_OPTION = {
 | 
			
		|||
    ISSUE: "issue",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const DOMAIN_STRATEGY_OPTION = {
 | 
			
		||||
    AS_IS: "AsIs",
 | 
			
		||||
    USE_IP: "UseIP",
 | 
			
		||||
    USE_IPV6V4: "UseIPv6v4",
 | 
			
		||||
    USE_IPV6: "UseIPv6",
 | 
			
		||||
    USE_IPV4V6: "UseIPv4v6",
 | 
			
		||||
    USE_IPV4: "UseIPv4",
 | 
			
		||||
    FORCE_IP: "ForceIP",
 | 
			
		||||
    FORCE_IPV6V4: "ForceIPv6v4",
 | 
			
		||||
    FORCE_IPV6: "ForceIPv6",
 | 
			
		||||
    FORCE_IPV4V6: "ForceIPv4v6",
 | 
			
		||||
    FORCE_IPV4: "ForceIPv4",
 | 
			
		||||
};
 | 
			
		||||
const TCP_CONGESTION_OPTION = {
 | 
			
		||||
    BBR: "bbr",
 | 
			
		||||
    CUBIC: "cubic",
 | 
			
		||||
    RENO: "reno",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Object.freeze(Protocols);
 | 
			
		||||
Object.freeze(SSMethods);
 | 
			
		||||
Object.freeze(XTLS_FLOW_CONTROL);
 | 
			
		||||
| 
						 | 
				
			
			@ -100,6 +119,8 @@ Object.freeze(UTLS_FINGERPRINT);
 | 
			
		|||
Object.freeze(ALPN_OPTION);
 | 
			
		||||
Object.freeze(SNIFFING_OPTION);
 | 
			
		||||
Object.freeze(USAGE_OPTION);
 | 
			
		||||
Object.freeze(DOMAIN_STRATEGY_OPTION);
 | 
			
		||||
Object.freeze(TCP_CONGESTION_OPTION);
 | 
			
		||||
 | 
			
		||||
class XrayCommonClass {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -881,7 +902,24 @@ RealityStreamSettings.Settings = class extends XrayCommonClass {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
class SockoptStreamSettings extends XrayCommonClass {
 | 
			
		||||
    constructor(acceptProxyProtocol = false, tcpFastOpen = false, mark = 0, tproxy="off", tcpMptcp = false, tcpNoDelay = false) {
 | 
			
		||||
    constructor(
 | 
			
		||||
        acceptProxyProtocol = false,
 | 
			
		||||
        tcpFastOpen = false,
 | 
			
		||||
        mark = 0,
 | 
			
		||||
        tproxy="off",
 | 
			
		||||
        tcpMptcp = false,
 | 
			
		||||
        tcpNoDelay = false,
 | 
			
		||||
        domainStrategy = DOMAIN_STRATEGY_OPTION.USE_IP,
 | 
			
		||||
        tcpMaxSeg = 1440,
 | 
			
		||||
        dialerProxy = "",
 | 
			
		||||
        tcpKeepAliveInterval = 0,   
 | 
			
		||||
        tcpKeepAliveIdle = 300,
 | 
			
		||||
        tcpUserTimeout = 10000,
 | 
			
		||||
        tcpcongestion = TCP_CONGESTION_OPTION.BBR,
 | 
			
		||||
        V6Only = false,
 | 
			
		||||
        tcpWindowClamp = 600,
 | 
			
		||||
        interfaceName = "",
 | 
			
		||||
    ) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.acceptProxyProtocol = acceptProxyProtocol;
 | 
			
		||||
        this.tcpFastOpen = tcpFastOpen;
 | 
			
		||||
| 
						 | 
				
			
			@ -889,6 +927,16 @@ class SockoptStreamSettings extends XrayCommonClass {
 | 
			
		|||
        this.tproxy = tproxy;
 | 
			
		||||
        this.tcpMptcp = tcpMptcp;
 | 
			
		||||
        this.tcpNoDelay = tcpNoDelay;
 | 
			
		||||
        this.domainStrategy = domainStrategy;
 | 
			
		||||
        this.tcpMaxSeg = tcpMaxSeg;
 | 
			
		||||
        this.dialerProxy = dialerProxy;
 | 
			
		||||
        this.tcpKeepAliveInterval = tcpKeepAliveInterval;
 | 
			
		||||
        this.tcpKeepAliveIdle = tcpKeepAliveIdle;
 | 
			
		||||
        this.tcpUserTimeout = tcpUserTimeout;
 | 
			
		||||
        this.tcpcongestion = tcpcongestion;
 | 
			
		||||
        this.V6Only = V6Only;
 | 
			
		||||
        this.tcpWindowClamp = tcpWindowClamp;
 | 
			
		||||
        this.interfaceName = interfaceName;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    static fromJson(json = {}) {
 | 
			
		||||
| 
						 | 
				
			
			@ -900,6 +948,16 @@ class SockoptStreamSettings extends XrayCommonClass {
 | 
			
		|||
            json.tproxy,
 | 
			
		||||
            json.tcpMptcp,
 | 
			
		||||
            json.tcpNoDelay,
 | 
			
		||||
            json.domainStrategy,
 | 
			
		||||
            json.tcpMaxSeg,
 | 
			
		||||
            json.dialerProxy,
 | 
			
		||||
            json.tcpKeepAliveInterval,
 | 
			
		||||
            json.tcpKeepAliveIdle,
 | 
			
		||||
            json.tcpUserTimeout,
 | 
			
		||||
            json.tcpcongestion,
 | 
			
		||||
            json.V6Only,
 | 
			
		||||
            json.tcpWindowClamp,
 | 
			
		||||
            json.interface,
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -911,6 +969,16 @@ class SockoptStreamSettings extends XrayCommonClass {
 | 
			
		|||
            tproxy: this.tproxy,
 | 
			
		||||
            tcpMptcp: this.tcpMptcp,
 | 
			
		||||
            tcpNoDelay: this.tcpNoDelay,
 | 
			
		||||
            domainStrategy: this.domainStrategy,
 | 
			
		||||
            tcpMaxSeg: this.tcpMaxSeg,
 | 
			
		||||
            dialerProxy: this.dialerProxy,
 | 
			
		||||
            tcpKeepAliveInterval: this.tcpKeepAliveInterval,
 | 
			
		||||
            tcpKeepAliveIdle: this.tcpKeepAliveIdle,
 | 
			
		||||
            tcpUserTimeout: this.tcpUserTimeout,
 | 
			
		||||
            tcpcongestion: this.tcpcongestion,
 | 
			
		||||
            V6Only: this.V6Only,
 | 
			
		||||
            tcpWindowClamp: this.tcpWindowClamp,
 | 
			
		||||
            interface: this.interfaceName,
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,28 +5,62 @@
 | 
			
		|||
        <a-switch v-model="inbound.stream.sockoptSwitch"></a-switch>
 | 
			
		||||
    </a-form-item>
 | 
			
		||||
    <template v-if="inbound.stream.sockoptSwitch">
 | 
			
		||||
        <a-form-item label="Route Mark">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.mark" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP Keep Alive Interval">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.tcpKeepAliveInterval" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP Keep Alive Idle">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.tcpKeepAliveIdle" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP Max Seg">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.tcpMaxSeg" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP User Timeout">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.tcpUserTimeout" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP Window Clamp">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.tcpWindowClamp" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="Proxy Protocol">
 | 
			
		||||
            <a-switch v-model="inbound.stream.sockopt.acceptProxyProtocol"></a-switch>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP Fast Open">
 | 
			
		||||
            <a-switch v-model.trim="inbound.stream.sockopt.tcpFastOpen"></a-switch>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="Route Mark">
 | 
			
		||||
            <a-input-number v-model="inbound.stream.sockopt.mark" :min="0"></a-input-number>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TProxy">
 | 
			
		||||
            <a-select v-model="inbound.stream.sockopt.tproxy" :dropdown-class-name="themeSwitcher.currentTheme">
 | 
			
		||||
                <a-select-option value="off">Off</a-select-option>
 | 
			
		||||
                <a-select-option value="redirect">Redirect</a-select-option>
 | 
			
		||||
                <a-select-option value="tproxy">TProxy</a-select-option>
 | 
			
		||||
            </a-select>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="Multipath TCP">
 | 
			
		||||
            <a-switch v-model.trim="inbound.stream.sockopt.tcpMptcp"></a-switch>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TCP No-Delay">
 | 
			
		||||
            <a-switch v-model.trim="inbound.stream.sockopt.tcpNoDelay"></a-switch>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="V6 Only">
 | 
			
		||||
            <a-switch v-model.trim="inbound.stream.sockopt.V6Only"></a-switch>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label='Domain Strategy'>
 | 
			
		||||
            <a-select v-model="inbound.stream.sockopt.domainStrategy" style="width: 50%" :dropdown-class-name="themeSwitcher.currentTheme">
 | 
			
		||||
              <a-select-option v-for="key in DOMAIN_STRATEGY_OPTION" :value="key">[[ key ]]</a-select-option>
 | 
			
		||||
            </a-select>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label='TCP Congestion'>
 | 
			
		||||
            <a-select v-model="inbound.stream.sockopt.tcpcongestion" style="width: 50%" :dropdown-class-name="themeSwitcher.currentTheme">
 | 
			
		||||
              <a-select-option v-for="key in TCP_CONGESTION_OPTION" :value="key">[[ key ]]</a-select-option>
 | 
			
		||||
            </a-select>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="TProxy">
 | 
			
		||||
            <a-select v-model="inbound.stream.sockopt.tproxy" style="width: 50%" :dropdown-class-name="themeSwitcher.currentTheme">
 | 
			
		||||
                <a-select-option value="off">Off</a-select-option>
 | 
			
		||||
                <a-select-option value="redirect">Redirect</a-select-option>
 | 
			
		||||
                <a-select-option value="tproxy">TProxy</a-select-option>
 | 
			
		||||
            </a-select>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="Dialer Proxy">
 | 
			
		||||
            <a-input v-model="inbound.stream.sockopt.dialerProxy"></a-input>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
        <a-form-item label="Interface Name">
 | 
			
		||||
            <a-input v-model="inbound.stream.sockopt.interfaceName"></a-input>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
    </template>
 | 
			
		||||
</a-form>
 | 
			
		||||
{{end}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue