3x-ui/xray/inbound.go

47 lines
1.1 KiB
Go
Raw Normal View History

2023-02-09 22:18:06 +03:00
package xray
import (
"bytes"
2023-02-09 22:18:06 +03:00
"x-ui/util/json_util"
)
type InboundConfig struct {
Listen json_util.RawMessage `json:"listen"` // listen cannot be an empty string
2023-02-09 22:18:06 +03:00
Port int `json:"port"`
Protocol string `json:"protocol"`
Settings json_util.RawMessage `json:"settings"`
StreamSettings json_util.RawMessage `json:"streamSettings"`
Tag string `json:"tag"`
Sniffing json_util.RawMessage `json:"sniffing"`
2024-09-16 12:41:21 +03:00
Allocate json_util.RawMessage `json:"allocate"`
2023-02-09 22:18:06 +03:00
}
func (c *InboundConfig) Equals(other *InboundConfig) bool {
if !bytes.Equal(c.Listen, other.Listen) {
return false
}
if c.Port != other.Port {
return false
}
if c.Protocol != other.Protocol {
return false
}
if !bytes.Equal(c.Settings, other.Settings) {
return false
}
if !bytes.Equal(c.StreamSettings, other.StreamSettings) {
return false
}
if c.Tag != other.Tag {
return false
}
if !bytes.Equal(c.Sniffing, other.Sniffing) {
return false
}
2024-09-16 12:41:21 +03:00
if !bytes.Equal(c.Allocate, other.Allocate) {
return false
}
2023-02-09 22:18:06 +03:00
return true
}