mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
0.0.1
This commit is contained in:
@@ -1,20 +1,41 @@
|
||||
package xray
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"bytes"
|
||||
"x-ui/util/json_util"
|
||||
)
|
||||
|
||||
type InboundConfig struct {
|
||||
Listen json.RawMessage `json:"listen"` // listen 不能为空字符串
|
||||
Port int `json:"port"`
|
||||
Protocol string `json:"protocol"`
|
||||
Settings json.RawMessage `json:"settings"`
|
||||
StreamSettings json.RawMessage `json:"streamSettings"`
|
||||
Tag string `json:"tag"`
|
||||
Sniffing json.RawMessage `json:"sniffing"`
|
||||
Listen json_util.RawMessage `json:"listen"` // listen 不能为空字符串
|
||||
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"`
|
||||
}
|
||||
|
||||
func (i *InboundConfig) MarshalJSON() ([]byte, error) {
|
||||
return json_util.MarshalJSON(i)
|
||||
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
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user