Exemple #1
0
 public ProxyClient(IOptions <ClientOptions> options
                    , ILogger <ProxyClient> logger
                    , IPackageEncoder <ProxyPackage> encoder
                    , IPackageDecoder <ProxyPackage> decoder)
 {
     this.logger  = logger;
     this.options = options?.Value;
     Checker.NotNull(this.options);
     this.encoder           = encoder;
     this.decoder           = decoder;
     channelOptions         = new ChannelOptions();
     clientConnectionHolder = new Dictionary <int, IConnection>();
 }
Exemple #2
0
 public ProxyClientConnection(ILogger logger
                              , IPAddress serverAddress
                              , int serverPort
                              , ChannelConfig channelConfig
                              , IPackageEncoder <ProxyPackage> encoder
                              , IPackageDecoder <ProxyPackage> decoder)
 {
     this.serverPort     = serverPort;
     this.channelConfig  = channelConfig;
     this.logger         = logger;
     this.serverAddress  = serverAddress;
     this.encoder        = encoder;
     this.decoder        = decoder;
     channelOptions      = new ChannelOptions();
     serverChannelHolder = new Dictionary <long, IChannel>();
 }
 private static IHostBuilder ConfigurePackageDecoderCore <TReceivePackage>(IHostBuilder hostBuilder, IPackageDecoder <TReceivePackage> packageDecoder)
     where TReceivePackage : class
 {
     return(hostBuilder.ConfigureServices(
                (hostCtx, services) =>
     {
         services.AddSingleton <IPackageDecoder <TReceivePackage> >(packageDecoder);
     }
                ));
 }
 public static IHostBuilder <TReceivePackage> ConfigurePackageDecoder <TReceivePackage>(this IHostBuilder <TReceivePackage> hostBuilder, IPackageDecoder <TReceivePackage> packageDecoder)
     where TReceivePackage : class
 {
     return(ConfigurePackageDecoderCore <TReceivePackage>(hostBuilder, packageDecoder) as IHostBuilder <TReceivePackage>);
 }
 public PipelineFilterFactoryBase(IServiceProvider serviceProvider)
 {
     PackageDecoder = serviceProvider.GetService(typeof(IPackageDecoder <TPackageInfo>)) as IPackageDecoder <TPackageInfo>;
 }
Exemple #6
0
 public PipePackageFilter(IPackageDecoder <TPackage> decoder)
 {
     Decoder = decoder;
 }
 public static SuperSocketHostBuilder <TReceivePackage> UsePackageDecoder <TReceivePackage>(this ISuperSocketHostBuilder hostBuilder, IPackageDecoder <TReceivePackage> packageDecoder)
 {
     return(hostBuilder.AsSuperSocketBuilder <TReceivePackage>().UsePackageDecoder(packageDecoder));
 }
 public static SuperSocketHostBuilder <TReceivePackage> ConfigurePackageDecoder <TReceivePackage>(this SuperSocketHostBuilder <TReceivePackage> hostBuilder, IPackageDecoder <TReceivePackage> packageDecoder)
     where TReceivePackage : class
 {
     return(hostBuilder.UsePackageDecoder(packageDecoder));
 }
Exemple #9
0
 public HeaderPackageFilter(IPackageDecoder <TPackage> decoder) : base(decoder)
 {
 }
        private static IServiceCollection ConfigurePackageDecoderCore <TReceivePackage>(IServiceCollection services, IPackageDecoder <TReceivePackage> packageDecoder)
            where TReceivePackage : class
        {
            services.AddSingleton <IPackageDecoder <TReceivePackage> >(packageDecoder);

            return(services);
        }
 public static IServiceCollection ConfigurePackageDecoder <TReceivePackage>(this IServiceCollection services, IPackageDecoder <TReceivePackage> packageDecoder)
     where TReceivePackage : class
 {
     return(ConfigurePackageDecoderCore <TReceivePackage>(services, packageDecoder));
 }