SocketConfig.fromJson constructor
SocketConfig.fromJson(
- Object? json
Implementation
factory SocketConfig.fromJson(Object? json) {
final map = asJsonMap(json, 'sockopt');
return SocketConfig(
mark: map['mark'] as int?,
tcpFastOpen: map['tcpFastOpen'],
tproxy: map['tproxy'] == null ? null : TProxyMode.fromJson(map['tproxy']),
acceptProxyProtocol: map['acceptProxyProtocol'] as bool?,
domainStrategy: map['domainStrategy'] == null
? null
: XrayTargetStrategyJson.fromJson(map['domainStrategy']),
dialerProxy: map['dialerProxy'] as String?,
tcpKeepAliveInterval: map['tcpKeepAliveInterval'] as int?,
tcpKeepAliveIdle: map['tcpKeepAliveIdle'] as int?,
tcpCongestion: map['tcpCongestion'] as String?,
tcpWindowClamp: map['tcpWindowClamp'] as int?,
tcpMaxSeg: map['tcpMaxSeg'] as int?,
penetrate: map['penetrate'] as bool?,
tcpUserTimeout: map['tcpUserTimeout'] as int?,
v6only: map['v6only'] as bool?,
interfaceName: map['interface'] as String?,
tcpMptcp: map['tcpMptcp'] as bool?,
customSockopt: map['customSockopt'] == null
? null
: asJsonList(map['customSockopt'], CustomSockoptConfig.fromJson),
addressPortStrategy: map['addressPortStrategy'] == null
? null
: AddressPortStrategy.fromJson(map['addressPortStrategy']),
happyEyeballs: map['happyEyeballs'] == null
? null
: HappyEyeballsConfig.fromJson(map['happyEyeballs']),
trustedXForwardedFor: (map['trustedXForwardedFor'] as List?)
?.cast<String>(),
);
}