http_factory.go 562 B

1234567891011121314151617181920
  1. package http
  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("http",
  10. func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
  11. if !space.HasApp(dispatcher.APP_ID) {
  12. return nil, internal.ErrorBadConfiguration
  13. }
  14. return NewHttpProxyServer(
  15. rawConfig.(*Config),
  16. space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)), nil
  17. })
  18. }