TLSConfig.fromJson constructor

TLSConfig.fromJson(
  1. Object? json
)

Implementation

factory TLSConfig.fromJson(Object? json) {
  final map = asJsonMap(json, 'tlsSettings');
  return TLSConfig(
    allowInsecure: map['allowInsecure'] as bool?,
    certs: map['certificates'] == null
        ? null
        : asJsonList(map['certificates'], TLSCertConfig.fromJson),
    serverName: map['serverName'] as String?,
    alpn: map['alpn'] == null ? null : XrayStringList.fromJson(map['alpn']),
    enableSessionResumption: map['enableSessionResumption'] as bool?,
    disableSystemRoot: map['disableSystemRoot'] as bool?,
    minVersion: map['minVersion'] as String?,
    maxVersion: map['maxVersion'] as String?,
    cipherSuites: map['cipherSuites'] as String?,
    fingerprint: map['fingerprint'] as String?,
    rejectUnknownSNI: map['rejectUnknownSni'] as bool?,
    curvePreferences: map['curvePreferences'] == null
        ? null
        : XrayStringList.fromJson(map['curvePreferences']),
    masterKeyLog: map['masterKeyLog'] as String?,
    pinnedPeerCertSha256: map['pinnedPeerCertSha256'] as String?,
    verifyPeerCertByName: map['verifyPeerCertByName'] as String?,
    verifyPeerCertInNames: (map['verifyPeerCertInNames'] as List?)
        ?.cast<String>(),
    echServerKeys: map['echServerKeys'] as String?,
    echConfigList: map['echConfigList'] as String?,
    echForceQuery: map['echForceQuery'] == null
        ? null
        : ECHForceQuery.fromJson(map['echForceQuery']),
    echSocketSettings: map['echSockopt'] == null
        ? null
        : SocketConfig.fromJson(map['echSockopt']),
  );
}