base.go 686 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package proxy
  2. type Base struct {
  3. Name string `yaml:"name" json:"name"`
  4. Server string `yaml:"server" json:"server"`
  5. Port int `yaml:"port" json:"port"`
  6. Type string `yaml:"type" json:"type"`
  7. UDP bool `yaml:"udp,omitempty" json:"udp,omitempty"`
  8. }
  9. func (b *Base) TypeName() string {
  10. if b.Type == "" {
  11. return "unknown"
  12. }
  13. return b.Type
  14. }
  15. func (b *Base) SetName(name string) {
  16. b.Name = name
  17. }
  18. func (b *Base) BaseInfo() *Base {
  19. return b
  20. }
  21. func (b *Base) Clone() Base {
  22. c := *b
  23. return c
  24. }
  25. type Proxy interface {
  26. String() string
  27. ToClash() string
  28. ToSurge() string
  29. Identifier() string
  30. SetName(name string)
  31. TypeName() string
  32. BaseInfo() *Base
  33. Clone() Proxy
  34. }