inbound.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package xray
  2. import (
  3. "bytes"
  4. "x-ui/util/json_util"
  5. )
  6. type InboundConfig struct {
  7. Listen json_util.RawMessage `json:"listen"` // listen cannot be an empty string
  8. Port int `json:"port"`
  9. Protocol string `json:"protocol"`
  10. Settings json_util.RawMessage `json:"settings"`
  11. StreamSettings json_util.RawMessage `json:"streamSettings"`
  12. Tag string `json:"tag"`
  13. Sniffing json_util.RawMessage `json:"sniffing"`
  14. Allocate json_util.RawMessage `json:"allocate"`
  15. }
  16. func (c *InboundConfig) Equals(other *InboundConfig) bool {
  17. if !bytes.Equal(c.Listen, other.Listen) {
  18. return false
  19. }
  20. if c.Port != other.Port {
  21. return false
  22. }
  23. if c.Protocol != other.Protocol {
  24. return false
  25. }
  26. if !bytes.Equal(c.Settings, other.Settings) {
  27. return false
  28. }
  29. if !bytes.Equal(c.StreamSettings, other.StreamSettings) {
  30. return false
  31. }
  32. if c.Tag != other.Tag {
  33. return false
  34. }
  35. if !bytes.Equal(c.Sniffing, other.Sniffing) {
  36. return false
  37. }
  38. if !bytes.Equal(c.Allocate, other.Allocate) {
  39. return false
  40. }
  41. return true
  42. }