dokodemo_factory.go 592 B

123456789101112131415161718192021
  1. package dokodemo
  2. import (
  3. "github.com/v2ray/v2ray-core/app"
  4. "github.com/v2ray/v2ray-core/app/dispatcher"
  5. "github.com/v2ray/v2ray-core/proxy"
  6. "github.com/v2ray/v2ray-core/proxy/internal"
  7. )
  8. func init() {
  9. internal.MustRegisterInboundHandlerCreator("dokodemo-door",
  10. func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
  11. config := rawConfig.(*Config)
  12. if !space.HasApp(dispatcher.APP_ID) {
  13. return nil, internal.ErrorBadConfiguration
  14. }
  15. return NewDokodemoDoor(
  16. config,
  17. space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)), nil
  18. })
  19. }