public Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("===== FastTunnel Client Start =====");

            config = _configuration.Get <AppSettings>().ClientSettings;

            _fastTunnelClient.Login(() =>
            {
                Connecter _client;

                try
                {
                    // 连接到的目标IP
                    _client = new Connecter(config.Common.ServerAddr, config.Common.ServerPort);
                    _client.Connect();
                }
                catch (Exception)
                {
                    Thread.Sleep(5000);
                    throw;
                }

                // 登录
                _client.Send(new Message <LogInMassage>
                {
                    MessageType = MessageType.C_LogIn,
                    Content     = new LogInMassage
                    {
                        Webs     = config.Webs,
                        SSH      = config.SSH,
                        AuthInfo = "ODadoNDONODHSoDMFMsdpapdoNDSHDoadpwPDNoWAHDoNfa"
                    },
                });

                return(_client);
            }, config.Common);

            return(Task.CompletedTask);
        }
Пример #2
0
        private static void Run(Appsettings settings)
        {
            var FastTunnelClient = new FastTunnelClient(settings.ClientSettings, new ConsoleLogger());

            FastTunnelClient.Login();
        }