socksfactory.go 536 B

1234567891011121314151617181920
  1. package socks
  2. import (
  3. "github.com/v2ray/v2ray-core/app"
  4. "github.com/v2ray/v2ray-core/proxy"
  5. "github.com/v2ray/v2ray-core/proxy/socks/config/json"
  6. )
  7. type SocksServerFactory struct {
  8. }
  9. func (factory SocksServerFactory) Create(dispatcher app.PacketDispatcher, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
  10. config := rawConfig.(*json.SocksConfig)
  11. config.Initialize()
  12. return NewSocksServer(dispatcher, config), nil
  13. }
  14. func init() {
  15. proxy.RegisterInboundConnectionHandlerFactory("socks", SocksServerFactory{})
  16. }