コード例 #1
0
 public TunnelBase(TunnelSocket socket)
 {
     this._socket              = socket;
     this.ID                   = Common.RemoveTIDFlags(BitConverter.ToUInt64(SodiumCore.GetRandomBytes(8), 0));
     this.ActivePipes          = new TreeDictionary <uint, PipeBase>();
     this.congestionController = new NoCongestionControl(_socket, 250, 500, 1, 500);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbstractTunnel"/> class on an
 /// existing abstractTunnel socket.
 /// </summary>
 /// <param name="socket">Socket.</param>
 /// <param name="tid">Tid.</param>
 public TunnelBase(TunnelSocket socket, UInt64 tid)
 {
     this._socket              = socket;
     this.ID                   = tid;
     this.ActivePipes          = new TreeDictionary <uint, PipeBase>();
     this.congestionController = new NoCongestionControl(_socket, 250, 500, 1, 500);
 }
コード例 #3
0
 public SecureTunnel(TunnelSocket socket)
     : base(socket)
 {
     State = TunnelState.Starting;
     //random TID
     ID               = Common.RemoveTIDFlags(BitConverter.ToUInt64(SodiumCore.GetRandomBytes(8), 0));
     TunnelSocket     = socket;
     State            = TunnelState.Disconnected;
     this.ControlPipe = new ControlPipe(this);
     mCurNonce        = SodiumCore.GetRandomBytes(24);
 }
コード例 #4
0
        public static TunnelSocket GetOrCreateTunnelSocket(short port)
        {
            TunnelSocket b;
            short        p = port;

            if (sTunnels.Find(ref p, out b))
            {
                return(b);
            }
            else
            {
                b = new TunnelSocket(port);
                b.Start();
            }
            return(b);
        }
コード例 #5
0
 internal static void ClostTunnelSocket(TunnelSocket tunnelSocket)
 {
     tunnelSocket.Close();
     sTunnels.Remove(tunnelSocket.Port);
 }