Пример #1
0
 public void Close()
 {
     Logger.Debug("Closing transports");
     if (TCPTransport != null)
     {
         TCPTransport.Close();
     }
     if (UDPTransport != null)
     {
         UDPTransport.Close();
     }
     foreach (var tunnelContainer in _tunnels.Values)
     {
         Logger.Debug("Closing tunnel " + tunnelContainer.Tunnel.Id);
         try
         {
             tunnelContainer.Tunnel.Close();
         }
         catch (Exception e)
         {
             Logger.Warn("Closing tunnel " + tunnelContainer.Tunnel.Id + " failed : " + e.Message);
         }
     }
     _tunnels.Clear();
 }
Пример #2
0
        public async void should_send_content_to_udp_endpoint()
        {
            var port   = new Random().Next(10000, 20000);
            var client = new UdpClient(port);

            UDPTransport.Send("127.0.0.1", port)
            .OnNext(new FormattedLogEvent {
                Content = "This is my content"
            });

            var response = await client.ReceiveAsync();

            var receivedContent = Encoding.ASCII.GetString(response.Buffer);

            Assert.Equal("This is my content", receivedContent);
        }
Пример #3
0
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.dnsContext = new XIMS.Communication.DNSProtocolContext();
            tcpip = new TCPIPTransport(this.components);
            udp = new UDPTransport(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.mStateExtender)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.mContextExtender)).BeginInit();
            // 
            // mContextExtender
            // 
            this.mContextExtender.DefaultContext = this.dnsContext;
            ((System.ComponentModel.ISupportInitialize)(this.mStateExtender)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.mContextExtender)).EndInit();

        }
Пример #4
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();
        mesh = new Mesh();
        mesh.Generate();

        textview2.Buffer.Text += "Hashname: " + mesh.Hashname + "\n";

        var builder = new UriBuilder(mesh.URI);

        builder.Host           = "127.0.0.1";
        builder.Port           = 8989;
        textview2.Buffer.Text += builder.ToString() + "\n";

        udp = new UDPTransport(new System.Net.IPEndPoint(System.Net.IPAddress.Any, 8989));
        udp.Listen(mesh);
        mesh.DebugLogEvent += new DebugLogHandler(OnDebugLog);
    }
Пример #5
0
        public void Start()
        {
            Mesh = new Mesh();
            Mesh.Generate();

            foreach (var cs in Mesh.Self.CipherSets)
            {
                ConsoleWriteLine($"{cs.Key.ToString("x2")}: {Telehash.Base32Encoder.EncodeStripped(cs.Value.Keys.PublicKey)}");
            }
            ConsoleWriteLine("Hashname: " + Mesh.Hashname);

            var builder = new UriBuilder(Mesh.URI);
            builder.Host = "127.0.0.1";
            builder.Port = 8989;
            ConsoleWriteLine(builder.ToString());

            udp = new UDPTransport(new System.Net.IPEndPoint(System.Net.IPAddress.Any, 8989));
            udp.Listen(Mesh);
            Mesh.DebugLogEvent += new DebugLogHandler(OnDebugLog);
        }
Пример #6
0
        public void Start()
        {
            Mesh = new Mesh();
            Mesh.Generate();

            foreach (var cs in Mesh.Self.CipherSets)
            {
                Console.WriteLine("{0}: {1}", cs.Key.ToString("x2"), Telehash.Base32Encoder.EncodeStripped(cs.Value.Keys.PublicKey));
            }
            Console.WriteLine("Hashname: " + Mesh.Hashname);

            var builder = new UriBuilder(Mesh.URI);

            builder.Host = "127.0.0.1";
            builder.Port = 8989;
            Console.WriteLine(builder.ToString());

            udp = new UDPTransport(new System.Net.IPEndPoint(System.Net.IPAddress.Any, 8989));
            udp.Listen(Mesh);
            Mesh.DebugLogEvent += new DebugLogHandler(OnDebugLog);
        }
Пример #7
0
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.ACK = new XIMS.Communication.AckSIP(this.components);
            this.BYE = new XIMS.Communication.ByeSIP(this.components);
            this.CANCEL = new XIMS.Communication.CancelSIP(this.components);
            this.INVITE = new XIMS.Communication.InviteSIP(this.components);
            this.OPTIONS = new XIMS.Communication.OptionsSIP(this.components);
            this.REGISTER = new XIMS.Communication.RegisterSIP(this.components);
            this.sipContext = new XIMS.Communication.SIPProtocolContext();
            this.tcpip = new XIMS.Communication.TCPIPTransport(this.components);
            this.tcpips = new XIMS.Communication.TCPIPTransport(this.components);
            this.udp = new XIMS.Communication.UDPTransport(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.transportExtender)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.authHandlerExtender)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.verbExtender)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.mStateExtender)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.mContextExtender)).BeginInit();
            // 
            // transportExtender
            // 
            this.transportExtender.DefaultTransport = this.udp;
            // 
            // mContextExtender
            // 
            this.mContextExtender.DefaultContext = this.sipContext;
            // 
            // ACK
            // 
            this.ACK.CommandDescription = "";
            this.ACK.CommandName = "";
            this.verbExtender.SetEnabled(this.ACK, true);
            // 
            // BYE
            // 
            this.BYE.CommandDescription = "";
            this.BYE.CommandName = "";
            this.verbExtender.SetEnabled(this.BYE, true);
            // 
            // CANCEL
            // 
            this.CANCEL.CommandDescription = "";
            this.CANCEL.CommandName = "";
            this.verbExtender.SetEnabled(this.CANCEL, true);
            // 
            // INVITE
            // 
            this.INVITE.CommandDescription = "";
            this.INVITE.CommandName = "";
            this.verbExtender.SetEnabled(this.INVITE, true);
            // 
            // OPTIONS
            // 
            this.OPTIONS.CommandDescription = "";
            this.OPTIONS.CommandName = "";
            this.verbExtender.SetEnabled(this.OPTIONS, true);
            // 
            // REGISTER
            // 
            this.REGISTER.CommandDescription = "";
            this.REGISTER.CommandName = "";
            this.verbExtender.SetEnabled(this.REGISTER, true);
            // 
            // sipContext
            // 
            this.mContextExtender.SetEnabled(this.sipContext, true);
            // 
            // tcpip
            // 
            this.tcpip.CommandDescription = "";
            this.tcpip.CommandName = "tcp";
            this.transportExtender.SetEnabled(this.tcpip, true);
            // 
            // tcpips
            // 
            this.tcpips.CommandDescription = "";
            this.tcpips.CommandName = "sips";
            // 
            // udp
            // 
            this.udp.CommandDescription = "";
            this.udp.CommandName = "sip";
            this.transportExtender.SetEnabled(this.udp, true);
            ((System.ComponentModel.ISupportInitialize)(this.transportExtender)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.authHandlerExtender)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.verbExtender)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.mStateExtender)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.mContextExtender)).EndInit();

        }
Пример #8
0
 public TransportManager()
 {
     _tunnels     = new Dictionary <string, TunnelContainer>();
     TCPTransport = new TCPTransport(this);
     UDPTransport = new UDPTransport(this);
 }