NetworkInterface
public class NetworkInterface : CallbackQueueProtocol
A (virtual) Network Interface
-
IPv4 address of the interface
Declaration
Swift
public var address: IP4Address { get } -
IPv4 netmask of the interface
Declaration
Swift
public var netmask: IP4Address { get } -
IPv4 gateway of the interface
Declaration
Swift
public var gateway: IP4Address { get } -
Create a new Network Interface
Declaration
Swift
public init(address: IP4Address, netmask: IP4Address, gateway: IP4Address, mtu: UInt16 = 1500, output: @escaping (Data) -> Void, ready: ((_ interface: NetworkInterface) -> Void)? = nil)Parameters
addressIPv4 address of the interface
netmaskIPv4 netmask of the interface
gatewayIPv4 gateway of the interface
mtumaximum transmission unit
outputfunction that writes packets to a packet stream
readywill be called once the interface is ready
-
Start dispatching events of the network interface and set the queue to deliver the events on.
Declaration
Swift
public func start(queue: DispatchQueue)Parameters
queueThe queue to dispatch the events on
-
Pass a packet to the network interface
Declaration
Swift
public func input(packet: Data) throws -
Remove the interface
Declaration
Swift
public func remove()
NetworkInterface Class Reference