Redefine generic Session.serverConfiguration()
For reuse in Session implementations.
This commit is contained in:
parent
68f308934a
commit
a232af1100
|
@ -70,6 +70,13 @@ public protocol Session {
|
||||||
*/
|
*/
|
||||||
func dataCount() -> (Int, Int)?
|
func dataCount() -> (Int, Int)?
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current server configuration.
|
||||||
|
|
||||||
|
- Returns: The current server configuration, represented as a generic object.
|
||||||
|
*/
|
||||||
|
func serverConfiguration() -> Any?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Shuts down the session with an optional `Error` reason. Does nothing if the session is already stopped or about to stop.
|
Shuts down the session with an optional `Error` reason. Does nothing if the session is already stopped or about to stop.
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
case .serverConfiguration:
|
case .serverConfiguration:
|
||||||
if let cfg = session?.serverConfiguration() {
|
if let cfg = session?.serverConfiguration() as? OpenVPN.Configuration {
|
||||||
let encoder = JSONEncoder()
|
let encoder = JSONEncoder()
|
||||||
response = try? encoder.encode(cfg)
|
response = try? encoder.encode(cfg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class OpenVPNSession: Session {
|
||||||
return controlChannel.currentDataCount()
|
return controlChannel.currentDataCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func serverConfiguration() -> OpenVPN.Configuration? {
|
public func serverConfiguration() -> Any? {
|
||||||
return pushReply?.options
|
return pushReply?.options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue