ProxyServer

open class ProxyServer: NSObject, TunnelDelegate

The base proxy server class.

This proxy does not listen on any port.

  • The port of proxy server.

    Declaration

    Swift

    open let port: Port
  • The address of proxy server.

    Declaration

    Swift

    open let address: IPAddress?
  • The type of the proxy server.

    This can be set to anything describing the proxy server.

    Declaration

    Swift

    open let type: String
  • The description of proxy server.

    Declaration

    Swift

    open override var description: String
  • Undocumented

    Declaration

    Swift

    open class ProxyServer: NSObject, TunnelDelegate
  • Undocumented

    Declaration

    Swift

    open class ProxyServer: NSObject, TunnelDelegate
  • Create an instance of proxy server.

    Warning

    If you are using Network Extension, you have to set address or you may not able to connect to the proxy server.

    Declaration

    Swift

    public init(address: IPAddress?, port: Port)

    Parameters

    address

    The address of proxy server.

    port

    The port of proxy server.

  • Start the proxy server.

    Throws

    The error occured when starting the proxy server.

    Declaration

    Swift

    open func start() throws
  • Stop the proxy server.

    Declaration

    Swift

    open func stop()
  • Delegate method when the proxy server accepts a new ProxySocket from local.

    When implementing a concrete proxy server, e.g., HTTP proxy server, the server should listen on some port and then wrap the raw socket in a corresponding ProxySocket subclass, then call this method.

    Declaration

    Swift

    func didAcceptNewSocket(_ socket: ProxySocket)

    Parameters

    socket

    The accepted proxy socket.

  • Delegate method when a tunnel closed. The server will remote it internally.

    Declaration

    Swift

    func tunnelDidClose(_ tunnel: Tunnel)

    Parameters

    tunnel

    The closed tunnel.