// NewClient create a new Shadowsocks client. func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) { serverList := protocol.NewServerList() for _, rec := range config.Server { serverList.AddServer(protocol.NewServerSpecFromPB(*rec)) } client := &Client{ serverPicker: protocol.NewRoundRobinServerPicker(serverList), } return client, nil }
func NewClient(config *ClientConfig, space app.Space, meta *proxy.OutboundHandlerMeta) (*Client, error) { serverList := protocol.NewServerList() for _, rec := range config.Server { serverList.AddServer(protocol.NewServerSpecFromPB(*rec)) } client := &Client{ serverPicker: protocol.NewRoundRobinServerPicker(serverList), meta: meta, } return client, nil }
func (v *Factory) Create(space app.Space, rawConfig interface{}, meta *proxy.OutboundHandlerMeta) (proxy.OutboundHandler, error) { vOutConfig := rawConfig.(*Config) serverList := protocol.NewServerList() for _, rec := range vOutConfig.Receiver { serverList.AddServer(protocol.NewServerSpecFromPB(*rec)) } handler := &VMessOutboundHandler{ serverList: serverList, serverPicker: protocol.NewRoundRobinServerPicker(serverList), meta: meta, } return handler, nil }
func New(ctx context.Context, config *Config) (*VMessOutboundHandler, error) { space := app.SpaceFromContext(ctx) if space == nil { return nil, errors.New("VMess|Outbound: No space in context.") } serverList := protocol.NewServerList() for _, rec := range config.Receiver { serverList.AddServer(protocol.NewServerSpecFromPB(*rec)) } handler := &VMessOutboundHandler{ serverList: serverList, serverPicker: protocol.NewRoundRobinServerPicker(serverList), } return handler, nil }