mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-16 20:55:39 +00:00
mobile: add host mode in NetCfg (#933)
This commit is contained in:
committed by
GitHub
parent
5d8d636adc
commit
7f78b08100
@@ -1293,6 +1293,8 @@ class ArchiveConfig(val archivePath: String, val disableCompression: Boolean? =
|
||||
@Serializable
|
||||
data class NetCfg(
|
||||
val socksProxy: String? = null,
|
||||
val hostMode: HostMode = HostMode.OnionViaSocks,
|
||||
val requiredHostMode: Boolean = false,
|
||||
val tcpConnectTimeout: Long, // microseconds
|
||||
val tcpTimeout: Long, // microseconds
|
||||
val tcpKeepAlive: KeepAliveOpts?,
|
||||
@@ -1322,6 +1324,13 @@ data class NetCfg(
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
enum class HostMode {
|
||||
@SerialName("onionViaSocks") OnionViaSocks,
|
||||
@SerialName("onion") Onion,
|
||||
@SerialName("public") Public;
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class KeepAliveOpts(
|
||||
val keepIdle: Int, // seconds
|
||||
|
||||
@@ -516,6 +516,8 @@ public struct ArchiveConfig: Encodable {
|
||||
|
||||
public struct NetCfg: Codable, Equatable {
|
||||
public var socksProxy: String? = nil
|
||||
public var hostMode: HostMode = .publicHost
|
||||
public var requiredHostMode = false
|
||||
public var tcpConnectTimeout: Int // microseconds
|
||||
public var tcpTimeout: Int // microseconds
|
||||
public var tcpKeepAlive: KeepAliveOpts?
|
||||
@@ -540,6 +542,12 @@ public struct NetCfg: Codable, Equatable {
|
||||
public var enableKeepAlive: Bool { tcpKeepAlive != nil }
|
||||
}
|
||||
|
||||
public enum HostMode: String, Codable {
|
||||
case onionViaSocks
|
||||
case onionHost = "onion"
|
||||
case publicHost = "public"
|
||||
}
|
||||
|
||||
public struct KeepAliveOpts: Codable, Equatable {
|
||||
public var keepIdle: Int // seconds
|
||||
public var keepIntvl: Int // seconds
|
||||
|
||||
Reference in New Issue
Block a user