Beispiel #1
0
        public GluonHost(GluonHostPool pool, string callSign, IKernel kernel, ServerConfiguration config)
        {
            this.Pool     = pool;
            this.CallSign = callSign;
            this.Client   = new AriesClient(Pool.Kernel);

            Callbacks = new Dictionary <Guid, TaskCompletionSource <IGluonCall> >();
            Client.AddSubscriber(this);

            Router = new AriesPacketRouter();
            Router.On <RequestClientSession>((session, message) =>
            {
                session.Write(new RequestChallenge()
                {
                    CallSign = CallSign, PublicHost = PublicHost, InternalHost = InternalHost
                });
            });
            Router.On <RequestChallengeResponse>((session, message) =>
            {
                var challenge = (RequestChallengeResponse)message;
                var answer    = ChallengeResponse.AnswerChallenge(challenge.Challenge, config.Secret);

                session.Write(new AnswerChallenge {
                    Answer = answer
                });
            });
            Router.On <AnswerAccepted>((session, message) =>
            {
                OnAuthenticated();
            });
        }
Beispiel #2
0
 public GluonHostPoolMonitor(GluonHostPool pool)
 {
     this.Pool = pool;
 }