Table of Contents

Class ForwardingManager

Namespace
VpnHood.Core.Tunneling.Forwarding
Assembly
VpnHood.Core.Tunneling.dll

Represents what sends a session's packets on to their destinations through the device's own network: UDP through UDP sockets, pings through pings, and TCP connections through the stream forwarding channels it is given.

public class ForwardingManager : PassthroughPacketTransport, IPacketTransport, IDisposable
Inheritance
ForwardingManager
Implements
Inherited Members

Remarks

The replies come back as received packets. A server forwards its sessions' packets so, as a client does what it bypasses.

Constructors

ForwardingManager(ISocketFactory, ForwardingManagerOptions)

Initializes a new instance of the ForwardingManager class.

public ForwardingManager(ISocketFactory socketFactory, ForwardingManagerOptions options)

Parameters

socketFactory ISocketFactory

The factory that makes its UDP sockets.

options ForwardingManagerOptions

The options.

Properties

IsIpV6Supported

Gets or sets a value indicating whether the manager forwards IPv6; otherwise, it drops IPv6 packets. The default is true.

public bool IsIpV6Supported { get; set; }

Property Value

bool

Traffic

Gets what the manager has forwarded: its packets, and the bytes of its stream forwarding channels, the ended ones too.

public Traffic Traffic { get; }

Property Value

Traffic

UdpClientCount

Gets the number of UDP sockets, closed ones not swept yet among them.

public int UdpClientCount { get; }

Property Value

int

Methods

AddChannel(StreamForwardingChannel, bool)

Takes a stream forwarding channel and starts it; the manager disposes it at its own end.

public void AddChannel(StreamForwardingChannel channel, bool disposeOnFail)

Parameters

channel StreamForwardingChannel

The channel.

disposeOnFail bool

true to dispose the channel where it cannot be taken.

Exceptions

ObjectDisposedException

The manager is disposed.

InvalidOperationException

The channel is already started.

DisposeManaged()

Releases managed resources; the base detaches the PacketReceived handlers. A derived class must catch its own errors.

protected override void DisposeManaged()

Remarks

It closes its UDP sockets, its pings and its channels at once.

SendPacket(IpPacket)

Hands one packet on, at once. Once handed on, the packet is no longer this transport's; throw only before.

protected override void SendPacket(IpPacket ipPacket)

Parameters

ipPacket IpPacket

The packet.

Remarks

A UDP packet goes to its UDP socket, and an ICMP one to a ping.

Exceptions

PacketDropException

The packet is IPv6, which the manager does not forward.

NotSupportedException

The packet is a ping, which the manager does not forward.

Exception

The packet is neither UDP nor ICMP.