socksfactory.go 468 B

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