config.go 758 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package proxyman
  2. func (s *AllocationStrategy) GetConcurrencyValue() uint32 {
  3. if s == nil || s.Concurrency == nil {
  4. return 3
  5. }
  6. return s.Concurrency.Value
  7. }
  8. func (s *AllocationStrategy) GetRefreshValue() uint32 {
  9. if s == nil || s.Refresh == nil {
  10. return 5
  11. }
  12. return s.Refresh.Value
  13. }
  14. func (c *ReceiverConfig) GetEffectiveSniffingSettings() *SniffingConfig {
  15. if c.SniffingSettings != nil {
  16. return c.SniffingSettings
  17. }
  18. if len(c.DomainOverride) > 0 {
  19. var p []string
  20. for _, kd := range c.DomainOverride {
  21. switch kd {
  22. case KnownProtocols_HTTP:
  23. p = append(p, "http")
  24. case KnownProtocols_TLS:
  25. p = append(p, "tls")
  26. }
  27. }
  28. return &SniffingConfig{
  29. Enabled: true,
  30. DestinationOverride: p,
  31. }
  32. }
  33. return nil
  34. }