示例#1
0
 /// <summary>
 /// Create a new server on endpoint
 /// </summary>
 /// <param name="localEndpoint"></param>
 /// <param name="dictionary"></param>
 /// <param name="serverType"></param>
 public RadiusServer(IUdpClientFactory udpClientFactory, IPEndPoint localEndpoint, IRadiusDictionary dictionary, RadiusServerType serverType)
 {
     _udpClientFactory = udpClientFactory;
     _localEndpoint    = localEndpoint;
     _dictionary       = dictionary;
     _serverType       = serverType;
 }
示例#2
0
        public UdpProxy(
            IReadOnlyTcpStream clientStream,
            IUdpClientFactory clientFactory,
            IDatagramInterceptor interceptor,
            ArrayPool <byte> bufferPool,
            ITimerFactory timerFactory,
            ILoggerFactory loggerFactory)
        {
            if (clientFactory == null)
            {
                throw new ArgumentNullException(nameof(clientFactory));
            }
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            this._clientStream = clientStream ?? throw new ArgumentNullException(nameof(clientStream));
            this._interceptor  = interceptor ?? throw new ArgumentNullException(nameof(interceptor));
            this._bufferPool   = bufferPool ?? throw new ArgumentNullException(nameof(bufferPool));

            this._boundClient = clientFactory.CreateBoundUdpClient(
                new IPEndPoint(((IPEndPoint)clientStream.LocalEndPoint).Address, 0));
            this._relayClient        = clientFactory.CreateUdpClient();
            this._reassembler        = new DatagramReassembler(timerFactory, this._bufferPool);
            this._clientEndPointTask =
                new TaskCompletionSource <EndPoint>(TaskCreationOptions.RunContinuationsAsynchronously);

            this._clientSessionTerminationSource = new CancellationTokenSource();
            this._log = loggerFactory.CreateLogger(this.GetType().Name);
            this._log.LogInformation("Started UDP listener on {0}", this.BindEndPoint);
        }
 /// <summary>
 /// Create a new server on endpoint
 /// </summary>
 /// <param name="localEndpoint"></param>
 /// <param name="dictionary"></param>
 /// <param name="serverType"></param>
 public RadiusServer(IUdpClientFactory udpClientFactory, IPEndPoint localEndpoint, IRadiusDictionary dictionary, RadiusServerType serverType, IPacketHandlerRepository packetHandlerRepository)
 {
     _udpClientFactory        = udpClientFactory;
     _localEndpoint           = localEndpoint;
     _dictionary              = dictionary;
     _serverType              = serverType;
     _packetHandlerRepository = packetHandlerRepository;
 }
 /// <summary>
 /// Create a new server on endpoint with packet handler repository
 /// </summary>
 /// <param name="udpClientFactory"></param>
 /// <param name="localEndpoint"></param>
 /// <param name="radiusPacketParser"></param>
 /// <param name="serverType"></param>
 /// <param name="packetHandlerRepository"></param>
 /// <param name="logger"></param>
 public RadiusServer(IUdpClientFactory udpClientFactory, IPEndPoint localEndpoint, IRadiusPacketParser radiusPacketParser, RadiusServerType serverType, IPacketHandlerRepository packetHandlerRepository, ILogger <RadiusServer> logger)
 {
     _udpClientFactory        = udpClientFactory;
     _localEndpoint           = localEndpoint;
     _radiusPacketParser      = radiusPacketParser;
     _serverType              = serverType;
     _packetHandlerRepository = packetHandlerRepository;
     _logger = logger;
 }
示例#5
0
        public DiscoveryClient(IUdpClientFactory udpClientFactory)
        {
            if (udpClientFactory == null)
            {
                throw new ArgumentNullException(nameof(udpClientFactory));
            }

            _udpClientFactory = udpClientFactory;
        }
 public DefaultProxyFactory(
     IDatagramInterceptor datagramInterceptor,
     ITcpConnector tcpConnector,
     IUdpClientFactory udpClientFactory,
     ILoggerFactory loggerFactory)
 {
     this._datagramInterceptor = datagramInterceptor
                                 ?? throw new ArgumentNullException(nameof(datagramInterceptor));
     this._tcpConnector     = tcpConnector ?? throw new ArgumentNullException(nameof(tcpConnector));
     this._udpClientFactory = udpClientFactory ?? throw new ArgumentNullException(nameof(udpClientFactory));
     this._loggerFactory    = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     this._timerFactory     = ThreadingTimerFactory.Instance;
 }
示例#7
0
 public WakeUpService(IIpNetworkCalculationsService networkService, IUdpClientFactory udpClientFactory)
 {
     _networkService   = networkService;
     _udpClientFactory = udpClientFactory;
 }
 /// <summary>
 /// Create a new server on endpoint
 /// </summary>
 /// <param name="udpClientFactory"></param>
 /// <param name="localEndpoint"></param>
 /// <param name="radiusPacketParser"></param>
 /// <param name="serverType"></param>
 /// <param name="logger"></param>
 public RadiusServer(IUdpClientFactory udpClientFactory, IPEndPoint localEndpoint, IRadiusPacketParser radiusPacketParser, RadiusServerType serverType, ILogger <RadiusServer> logger) : this
     (udpClientFactory, localEndpoint, radiusPacketParser, serverType, new PacketHandlerRepository(), logger)
 {
 }
示例#9
0
 /// <summary>
 /// Creates an instance of <see cref="Discovery"/>
 /// </summary>
 /// <param name="clientFactory">An UDP client factory instance</param>
 public Discovery(IUdpClientFactory clientFactory)
 {
     this.clientFactory = clientFactory;
 }