config.go 668 B

123456789101112131415161718192021222324252627282930313233
  1. package proxyman
  2. import (
  3. "context"
  4. "errors"
  5. "v2ray.com/core/proxy"
  6. )
  7. func (s *AllocationStrategy) GetConcurrencyValue() uint32 {
  8. if s == nil || s.Concurrency == nil {
  9. return 3
  10. }
  11. return s.Concurrency.Value
  12. }
  13. func (s *AllocationStrategy) GetRefreshValue() uint32 {
  14. if s == nil || s.Refresh == nil {
  15. return 5
  16. }
  17. return s.Refresh.Value
  18. }
  19. func (c *OutboundHandlerConfig) GetProxyHandler(ctx context.Context) (proxy.Outbound, error) {
  20. if c == nil {
  21. return nil, errors.New("Proxyman: OutboundHandlerConfig is nil.")
  22. }
  23. config, err := c.ProxySettings.GetInstance()
  24. if err != nil {
  25. return nil, err
  26. }
  27. return proxy.CreateOutboundHandler(ctx, config)
  28. }