XrayInbound.localSocksTunnel constructor
XrayInbound.localSocksTunnel({})
Implementation
factory XrayInbound.localSocksTunnel({
String tag = 'in_proxy',
String listen = '127.0.0.1',
int port = 10807,
int userLevel = 8,
String? username,
String? password,
}) {
if ((username == null) != (password == null) ||
username != null &&
(username.isEmpty ||
password!.isEmpty ||
username.codeUnits.any((c) => c < 0x21 || c > 0x7e) ||
password.codeUnits.any((c) => c < 0x21 || c > 0x7e) ||
username.length > 255 ||
password.length > 255)) {
throw ArgumentError('Local SOCKS credentials require printable ASCII '
'username and password, each 1–255 bytes.');
}
return XrayInbound(
tag: tag,
listen: listen,
port: port,
protocol: 'socks',
settings: {
'auth': username == null ? 'noauth' : 'password',
if (username != null)
'accounts': [
{'user': username, 'pass': password}
],
'udp': true,
'userLevel': userLevel,
'address': null,
'port': null,
'network': null,
},
sniffing: const XraySniffing(
enabled: true,
destOverride: ['http', 'tls', 'quic'],
metadataOnly: false,
),
);
}