proxy_cache.go 876 B

12345678910111213141516171819202122232425262728293031323334
  1. package proxy
  2. var (
  3. inboundFactories = make(map[string]InboundConnectionHandlerFactory)
  4. outboundFactories = make(map[string]OutboundConnectionHandlerFactory)
  5. )
  6. func RegisterInboundConnectionHandlerFactory(name string, factory InboundConnectionHandlerFactory) error {
  7. // TODO check name
  8. inboundFactories[name] = factory
  9. return nil
  10. }
  11. func RegisterOutboundConnectionHandlerFactory(name string, factory OutboundConnectionHandlerFactory) error {
  12. // TODO check name
  13. outboundFactories[name] = factory
  14. return nil
  15. }
  16. func GetInboundConnectionHandlerFactory(name string) InboundConnectionHandlerFactory {
  17. factory, found := inboundFactories[name]
  18. if !found {
  19. return nil
  20. }
  21. return factory
  22. }
  23. func GetOutboundConnectionHandlerFactory(name string) OutboundConnectionHandlerFactory {
  24. factory, found := outboundFactories[name]
  25. if !found {
  26. return nil
  27. }
  28. return factory
  29. }