config.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package point
  2. import (
  3. "github.com/v2ray/v2ray-core/app/dns"
  4. "github.com/v2ray/v2ray-core/app/router"
  5. "github.com/v2ray/v2ray-core/common/log"
  6. v2net "github.com/v2ray/v2ray-core/common/net"
  7. )
  8. type ConnectionConfig interface {
  9. Protocol() string
  10. Settings() []byte
  11. }
  12. type LogConfig interface {
  13. AccessLog() string
  14. ErrorLog() string
  15. LogLevel() log.LogLevel
  16. }
  17. type DnsConfig interface {
  18. Enabled() bool
  19. Settings() dns.CacheConfig
  20. }
  21. const (
  22. AllocationStrategyAlways = "always"
  23. AllocationStrategyRandom = "random"
  24. AllocationStrategyExternal = "external"
  25. )
  26. type InboundDetourAllocationConfig interface {
  27. Strategy() string // Allocation strategy of this inbound detour.
  28. Concurrency() int // Number of handlers (ports) running in parallel.
  29. Refresh() int // Number of seconds before a handler is regenerated.
  30. }
  31. type InboundDetourConfig interface {
  32. Protocol() string
  33. PortRange() v2net.PortRange
  34. Tag() string
  35. Allocation() InboundDetourAllocationConfig
  36. Settings() []byte
  37. }
  38. type OutboundDetourConfig interface {
  39. Protocol() string
  40. Tag() string
  41. Settings() []byte
  42. }
  43. type PointConfig interface {
  44. Port() v2net.Port
  45. LogConfig() LogConfig
  46. RouterConfig() *router.Config
  47. InboundConfig() ConnectionConfig
  48. OutboundConfig() ConnectionConfig
  49. InboundDetours() []InboundDetourConfig
  50. OutboundDetours() []OutboundDetourConfig
  51. }