Inheritance: Entity, IDisposable
Example #1
0
 public Cookie(OutboundHandshake handshake, byte[] tag, Target target)
 {
     Id = handshake.Id;
     CookieComputing = new CookieComputing(handshake);
     Target = target;
     PeerId = Target.Sha256.ComputeHash(CookieComputing.Nonce, 0, CookieComputing.Nonce.Length);
 }
 public void Connect(string url)
 {
     URL = url;
     var uri = new Uri(url);
     Target = new Target(new IPEndPoint(Dns.GetHostAddresses(uri.Host).First(x=>x.AddressFamily == AddressFamily.InterNetwork), uri.Port < 0 ? 1935 : uri.Port));
     Peer.Address = Target.Address;
     Handler.FarProtocol.IOHandler.Socket.Connect(Target.Address);
     Handler.FarProtocol.IOHandler.ReadEnabled = true;
     var rand = Utils.GenerateRandomBytes(16);
     HandShake30(rand);
     _handshakeTimeoutTimer.Start();
     _handshake = () => HandShake30(rand);
 }
Example #3
0
 public Middle(Peer peer, byte[] decryptKey, byte[] encryptKey, Target target)
     : base(peer, decryptKey, encryptKey)
 {
     QueryUrl = "rtmfp://202.109.143.196:555/live2";
     _outboundRtmfpProtocol = new OutboundRTMFPProtocol();
     _outboundRtmfpProtocol.OnConnect += () =>
     {
         foreach (var memoryStream in _buffer)
         {
            
             _outboundRtmfpProtocol.Session.SendStream(memoryStream,(int) memoryStream.Length);
         }
     };
     _outboundRtmfpProtocol.Session = new MiddleHandshake(_outboundRtmfpProtocol) { MiddleSession = this };
     _outboundRtmfpProtocol.Session.Connect(QueryUrl);
 }