entity.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. package entity
  2. import (
  3. "crypto/tls"
  4. "math"
  5. "net"
  6. "net/mail"
  7. "net/netip"
  8. "strings"
  9. "time"
  10. "github.com/mhsanaei/3x-ui/v3/internal/util/common"
  11. )
  12. type Msg struct {
  13. Success bool `json:"success"`
  14. Msg string `json:"msg"`
  15. Obj any `json:"obj"`
  16. }
  17. type AllSetting struct {
  18. WebListen string `json:"webListen" form:"webListen"`
  19. WebDomain string `json:"webDomain" form:"webDomain"`
  20. WebPort int `json:"webPort" form:"webPort" validate:"gte=1,lte=65535"`
  21. WebCertFile string `json:"webCertFile" form:"webCertFile"`
  22. WebKeyFile string `json:"webKeyFile" form:"webKeyFile"`
  23. WebBasePath string `json:"webBasePath" form:"webBasePath"`
  24. SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge" validate:"gte=1,lte=525600"`
  25. TrustedProxyCIDRs string `json:"trustedProxyCIDRs" form:"trustedProxyCIDRs"`
  26. RealityScanCandidates string `json:"realityScanCandidates" form:"realityScanCandidates"`
  27. IpLimitAllowlist string `json:"ipLimitAllowlist" form:"ipLimitAllowlist"`
  28. PanelOutbound string `json:"panelOutbound" form:"panelOutbound"`
  29. PageSize int `json:"pageSize" form:"pageSize" validate:"gte=0,lte=1000"`
  30. ExpireDiff int `json:"expireDiff" form:"expireDiff" validate:"gte=0"`
  31. TrafficDiff int `json:"trafficDiff" form:"trafficDiff" validate:"gte=0,lte=100"`
  32. RemarkTemplate string `json:"remarkTemplate" form:"remarkTemplate"`
  33. SubShowIdentityOnAllLinks bool `json:"subShowIdentityOnAllLinks" form:"subShowIdentityOnAllLinks"`
  34. SubInfoNodeEnable bool `json:"subInfoNodeEnable" form:"subInfoNodeEnable"`
  35. SubCalendarExpireInclusive bool `json:"subCalendarExpireInclusive" form:"subCalendarExpireInclusive"`
  36. SubExpiredTemplate string `json:"subExpiredTemplate" form:"subExpiredTemplate"`
  37. SubTrafficDepletedTemplate string `json:"subTrafficDepletedTemplate" form:"subTrafficDepletedTemplate"`
  38. Datepicker string `json:"datepicker" form:"datepicker"`
  39. TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"`
  40. TgBotToken string `json:"tgBotToken" form:"tgBotToken"`
  41. TgBotProxy string `json:"tgBotProxy" form:"tgBotProxy"`
  42. TgBotAPIServer string `json:"tgBotAPIServer" form:"tgBotAPIServer"`
  43. TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"`
  44. TgRunTime string `json:"tgRunTime" form:"tgRunTime"`
  45. TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"`
  46. TgCpu int `json:"tgCpu" form:"tgCpu" validate:"gte=0,lte=100"`
  47. TgMemory int `json:"tgMemory" form:"tgMemory" validate:"gte=0,lte=100"`
  48. TgLang string `json:"tgLang" form:"tgLang"`
  49. TgEnabledEvents string `json:"tgEnabledEvents" form:"tgEnabledEvents"`
  50. SmtpEnable bool `json:"smtpEnable" form:"smtpEnable"`
  51. SmtpHost string `json:"smtpHost" form:"smtpHost"`
  52. SmtpPort int `json:"smtpPort" form:"smtpPort" validate:"gte=1,lte=65535"`
  53. SmtpUsername string `json:"smtpUsername" form:"smtpUsername"`
  54. SmtpPassword string `json:"smtpPassword" form:"smtpPassword"`
  55. SmtpFrom string `json:"smtpFrom" form:"smtpFrom"`
  56. SmtpFromName string `json:"smtpFromName" form:"smtpFromName"`
  57. SmtpTo string `json:"smtpTo" form:"smtpTo"`
  58. SmtpEncryptionType string `json:"smtpEncryptionType" form:"smtpEncryptionType"`
  59. SmtpEnabledEvents string `json:"smtpEnabledEvents" form:"smtpEnabledEvents"`
  60. SmtpCpu int `json:"smtpCpu" form:"smtpCpu" validate:"gte=0,lte=100"`
  61. SmtpMemory int `json:"smtpMemory" form:"smtpMemory" validate:"gte=0,lte=100"`
  62. DiscordBotEnable bool `json:"discordBotEnable" form:"discordBotEnable"`
  63. DiscordBotToken string `json:"discordBotToken" form:"discordBotToken"`
  64. DiscordChannelId string `json:"discordChannelId" form:"discordChannelId"`
  65. DiscordAdminIds string `json:"discordAdminIds" form:"discordAdminIds"`
  66. DiscordRunTime string `json:"discordRunTime" form:"discordRunTime"`
  67. DiscordBotBackup bool `json:"discordBotBackup" form:"discordBotBackup"`
  68. DiscordCpu int `json:"discordCpu" form:"discordCpu" validate:"gte=0,lte=100"`
  69. DiscordMemory int `json:"discordMemory" form:"discordMemory" validate:"gte=0,lte=100"`
  70. DiscordLang string `json:"discordLang" form:"discordLang"`
  71. DiscordEnabledEvents string `json:"discordEnabledEvents" form:"discordEnabledEvents"`
  72. OutboundDownThreshold int `json:"outboundDownThreshold" form:"outboundDownThreshold" validate:"gte=1,lte=100"`
  73. TimeLocation string `json:"timeLocation" form:"timeLocation"`
  74. TwoFactorEnable bool `json:"twoFactorEnable" form:"twoFactorEnable"`
  75. TwoFactorToken string `json:"twoFactorToken" form:"twoFactorToken"`
  76. HappLinkEnable bool `json:"happLinkEnable" form:"happLinkEnable"`
  77. SubEnable bool `json:"subEnable" form:"subEnable"`
  78. SubJsonEnable bool `json:"subJsonEnable" form:"subJsonEnable"`
  79. SubJsonAutoDetect bool `json:"subJsonAutoDetect" form:"subJsonAutoDetect"`
  80. SubJsonAlwaysArray bool `json:"subJsonAlwaysArray" form:"subJsonAlwaysArray"`
  81. SubJsonUserAgentRegex string `json:"subJsonUserAgentRegex" form:"subJsonUserAgentRegex"`
  82. SubClashAutoDetect bool `json:"subClashAutoDetect" form:"subClashAutoDetect"`
  83. SubClashUserAgentRegex string `json:"subClashUserAgentRegex" form:"subClashUserAgentRegex"`
  84. SubTitle string `json:"subTitle" form:"subTitle"`
  85. SubSupportUrl string `json:"subSupportUrl" form:"subSupportUrl"`
  86. SubProfileMode string `json:"subProfileMode" form:"subProfileMode"`
  87. SubProfileUrl string `json:"subProfileUrl" form:"subProfileUrl"`
  88. SubAnnounce string `json:"subAnnounce" form:"subAnnounce"`
  89. SubEnableRouting bool `json:"subEnableRouting" form:"subEnableRouting"`
  90. SubRoutingRules string `json:"subRoutingRules" form:"subRoutingRules"`
  91. SubIncyEnableRouting bool `json:"subIncyEnableRouting" form:"subIncyEnableRouting"`
  92. SubIncyRoutingRules string `json:"subIncyRoutingRules" form:"subIncyRoutingRules"`
  93. SubListen string `json:"subListen" form:"subListen"`
  94. SubPort int `json:"subPort" form:"subPort" validate:"gte=1,lte=65535"`
  95. SubPath string `json:"subPath" form:"subPath"`
  96. SubDomain string `json:"subDomain" form:"subDomain"`
  97. SubCertFile string `json:"subCertFile" form:"subCertFile"`
  98. SubKeyFile string `json:"subKeyFile" form:"subKeyFile"`
  99. ExternalSubUserAgent string `json:"externalSubUserAgent" form:"externalSubUserAgent"`
  100. SubUpdates int `json:"subUpdates" form:"subUpdates" validate:"gte=0,lte=525600"`
  101. ExternalTrafficInformEnable bool `json:"externalTrafficInformEnable" form:"externalTrafficInformEnable"`
  102. ExternalTrafficInformURI string `json:"externalTrafficInformURI" form:"externalTrafficInformURI"`
  103. RestartXrayOnClientDisable bool `json:"restartXrayOnClientDisable" form:"restartXrayOnClientDisable"`
  104. SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"`
  105. SubURI string `json:"subURI" form:"subURI"`
  106. SubJsonPath string `json:"subJsonPath" form:"subJsonPath"`
  107. SubJsonURI string `json:"subJsonURI" form:"subJsonURI"`
  108. SubClashEnable bool `json:"subClashEnable" form:"subClashEnable"`
  109. SubClashPath string `json:"subClashPath" form:"subClashPath"`
  110. SubClashURI string `json:"subClashURI" form:"subClashURI"`
  111. SubClashEnableRouting bool `json:"subClashEnableRouting" form:"subClashEnableRouting"`
  112. SubClashRules string `json:"subClashRules" form:"subClashRules"`
  113. SubJsonMux string `json:"subJsonMux" form:"subJsonMux"`
  114. SubJsonRules string `json:"subJsonRules" form:"subJsonRules"`
  115. SubJsonRoutingRules string `json:"subJsonRoutingRules" form:"subJsonRoutingRules"`
  116. SubJsonDns string `json:"subJsonDns" form:"subJsonDns"`
  117. SubJsonFinalMask string `json:"subJsonFinalMask" form:"subJsonFinalMask"`
  118. SubJsonObservatory string `json:"subJsonObservatory" form:"subJsonObservatory"`
  119. SubThemeDir string `json:"subThemeDir" form:"subThemeDir"`
  120. SubHideSettings bool `json:"subHideSettings" form:"subHideSettings"`
  121. // Happ client customization settings (app-management / routing / UX).
  122. SubHappAutoDetect bool `json:"subHappAutoDetect" form:"subHappAutoDetect"`
  123. SubHappProviderId string `json:"subHappProviderId" form:"subHappProviderId"`
  124. SubHappNewUrl string `json:"subHappNewUrl" form:"subHappNewUrl"`
  125. SubHappFallbackUrl string `json:"subHappFallbackUrl" form:"subHappFallbackUrl"`
  126. SubHappSubInfoColor string `json:"subHappSubInfoColor" form:"subHappSubInfoColor"`
  127. SubHappSubInfoText string `json:"subHappSubInfoText" form:"subHappSubInfoText"`
  128. SubHappSubInfoButtonText string `json:"subHappSubInfoButtonText" form:"subHappSubInfoButtonText"`
  129. SubHappSubInfoButtonLink string `json:"subHappSubInfoButtonLink" form:"subHappSubInfoButtonLink"`
  130. SubHappSubExpire bool `json:"subHappSubExpire" form:"subHappSubExpire"`
  131. SubHappSubExpireButtonLink string `json:"subHappSubExpireButtonLink" form:"subHappSubExpireButtonLink"`
  132. SubHappNotificationExpire bool `json:"subHappNotificationExpire" form:"subHappNotificationExpire"`
  133. SubHappNoLimit bool `json:"subHappNoLimit" form:"subHappNoLimit"`
  134. SubHappAlwaysHwid bool `json:"subHappAlwaysHwid" form:"subHappAlwaysHwid"`
  135. SubHappTunMode string `json:"subHappTunMode" form:"subHappTunMode"`
  136. SubHappTunType string `json:"subHappTunType" form:"subHappTunType"`
  137. SubHappExcludeRoutes string `json:"subHappExcludeRoutes" form:"subHappExcludeRoutes"`
  138. SubHappExcludeApns bool `json:"subHappExcludeApns" form:"subHappExcludeApns"`
  139. SubHappColorProfile string `json:"subHappColorProfile" form:"subHappColorProfile"`
  140. SubHappPingType string `json:"subHappPingType" form:"subHappPingType"`
  141. SubHappAutoConnect bool `json:"subHappAutoConnect" form:"subHappAutoConnect"`
  142. SubHappAutoConnectType string `json:"subHappAutoConnectType" form:"subHappAutoConnectType"`
  143. SubHappPerAppMode string `json:"subHappPerAppMode" form:"subHappPerAppMode"`
  144. SubHappPerAppList string `json:"subHappPerAppList" form:"subHappPerAppList"`
  145. SubHappLocalProxyAuth string `json:"subHappLocalProxyAuth" form:"subHappLocalProxyAuth"`
  146. LdapEnable bool `json:"ldapEnable" form:"ldapEnable"`
  147. LdapHost string `json:"ldapHost" form:"ldapHost"`
  148. LdapPort int `json:"ldapPort" form:"ldapPort" validate:"gte=0,lte=65535"`
  149. LdapUseTLS bool `json:"ldapUseTLS" form:"ldapUseTLS"`
  150. LdapInsecureSkipVerify bool `json:"ldapInsecureSkipVerify" form:"ldapInsecureSkipVerify"`
  151. LdapBindDN string `json:"ldapBindDN" form:"ldapBindDN"`
  152. LdapPassword string `json:"ldapPassword" form:"ldapPassword"`
  153. LdapBaseDN string `json:"ldapBaseDN" form:"ldapBaseDN"`
  154. LdapUserFilter string `json:"ldapUserFilter" form:"ldapUserFilter"`
  155. LdapUserAttr string `json:"ldapUserAttr" form:"ldapUserAttr"`
  156. LdapVlessField string `json:"ldapVlessField" form:"ldapVlessField"`
  157. LdapSyncCron string `json:"ldapSyncCron" form:"ldapSyncCron"`
  158. LdapFlagField string `json:"ldapFlagField" form:"ldapFlagField"`
  159. LdapTruthyValues string `json:"ldapTruthyValues" form:"ldapTruthyValues"`
  160. LdapInvertFlag bool `json:"ldapInvertFlag" form:"ldapInvertFlag"`
  161. LdapInboundTags string `json:"ldapInboundTags" form:"ldapInboundTags"`
  162. LdapAutoCreate bool `json:"ldapAutoCreate" form:"ldapAutoCreate"`
  163. LdapAutoDelete bool `json:"ldapAutoDelete" form:"ldapAutoDelete"`
  164. LdapDefaultTotalGB int `json:"ldapDefaultTotalGB" form:"ldapDefaultTotalGB" validate:"gte=0"`
  165. LdapDefaultExpiryDays int `json:"ldapDefaultExpiryDays" form:"ldapDefaultExpiryDays" validate:"gte=0"`
  166. LdapDefaultLimitIP int `json:"ldapDefaultLimitIP" form:"ldapDefaultLimitIP" validate:"gte=0"`
  167. WarpUpdateInterval int `json:"warpUpdateInterval" form:"warpUpdateInterval" validate:"gte=0"`
  168. }
  169. type AllSettingView struct {
  170. AllSetting
  171. HasTgBotToken bool `json:"hasTgBotToken"`
  172. HasTwoFactorToken bool `json:"hasTwoFactorToken"`
  173. HasLdapPassword bool `json:"hasLdapPassword"`
  174. HasApiToken bool `json:"hasApiToken"`
  175. HasWarpSecret bool `json:"hasWarpSecret"`
  176. HasNordSecret bool `json:"hasNordSecret"`
  177. HasSmtpPassword bool `json:"hasSmtpPassword"`
  178. HasDiscordBotToken bool `json:"hasDiscordBotToken"`
  179. }
  180. func pathHasForbiddenChar(s string) bool {
  181. for _, r := range s {
  182. if r == '\\' || r == ' ' || r < 0x20 || r == 0x7f {
  183. return true
  184. }
  185. }
  186. return false
  187. }
  188. // CheckNetipAddrOrPrefixList mirrors parseIpLimitAllowlist exactly: net and netip
  189. // disagree (net accepts "/024", netip does not), so save and scan must share rules.
  190. func CheckNetipAddrOrPrefixList(list, message string) error {
  191. for entry := range strings.SplitSeq(list, ",") {
  192. entry = strings.TrimSpace(entry)
  193. if entry == "" {
  194. continue
  195. }
  196. if _, err := netip.ParseAddr(entry); err == nil {
  197. continue
  198. }
  199. if _, err := netip.ParsePrefix(entry); err != nil {
  200. return common.NewError(message, entry)
  201. }
  202. }
  203. return nil
  204. }
  205. // checkIPOrCIDRList rejects the first comma-separated entry that is neither a
  206. // bare address nor a CIDR, naming it with the caller's message.
  207. func checkIPOrCIDRList(list, message string) error {
  208. for entry := range strings.SplitSeq(list, ",") {
  209. entry = strings.TrimSpace(entry)
  210. if entry == "" {
  211. continue
  212. }
  213. if ip := net.ParseIP(entry); ip != nil {
  214. continue
  215. }
  216. if _, _, err := net.ParseCIDR(entry); err != nil {
  217. return common.NewError(message, entry)
  218. }
  219. }
  220. return nil
  221. }
  222. func (s *AllSetting) CheckValid() error {
  223. if s.WebListen != "" {
  224. ip := net.ParseIP(s.WebListen)
  225. if ip == nil {
  226. return common.NewError("web listen is not valid ip:", s.WebListen)
  227. }
  228. }
  229. if s.SubListen != "" {
  230. ip := net.ParseIP(s.SubListen)
  231. if ip == nil {
  232. return common.NewError("Sub listen is not valid ip:", s.SubListen)
  233. }
  234. }
  235. if s.WebPort <= 0 || s.WebPort > math.MaxUint16 {
  236. return common.NewError("web port is not a valid port:", s.WebPort)
  237. }
  238. if s.SubPort <= 0 || s.SubPort > math.MaxUint16 {
  239. return common.NewError("Sub port is not a valid port:", s.SubPort)
  240. }
  241. if (s.SubPort == s.WebPort) && listenAddressesConflict(s.WebListen, s.SubListen) {
  242. return common.NewError("Sub and Web could not use same ip:port, ", s.SubListen, ":", s.SubPort, " & ", s.WebListen, ":", s.WebPort)
  243. }
  244. if s.WebCertFile != "" || s.WebKeyFile != "" {
  245. _, err := tls.LoadX509KeyPair(s.WebCertFile, s.WebKeyFile)
  246. if err != nil {
  247. return common.NewErrorf("cert file <%v> or key file <%v> invalid: %v", s.WebCertFile, s.WebKeyFile, err)
  248. }
  249. }
  250. if s.SubCertFile != "" || s.SubKeyFile != "" {
  251. _, err := tls.LoadX509KeyPair(s.SubCertFile, s.SubKeyFile)
  252. if err != nil {
  253. return common.NewErrorf("cert file <%v> or key file <%v> invalid: %v", s.SubCertFile, s.SubKeyFile, err)
  254. }
  255. }
  256. for _, p := range []struct {
  257. name string
  258. value string
  259. }{
  260. {"web base path", s.WebBasePath},
  261. {"subscription path", s.SubPath},
  262. {"subscription JSON path", s.SubJsonPath},
  263. {"subscription Clash path", s.SubClashPath},
  264. } {
  265. if pathHasForbiddenChar(p.value) {
  266. return common.NewError("URI path contains an invalid character:", p.name)
  267. }
  268. }
  269. if !strings.HasPrefix(s.WebBasePath, "/") {
  270. s.WebBasePath = "/" + s.WebBasePath
  271. }
  272. if !strings.HasSuffix(s.WebBasePath, "/") {
  273. s.WebBasePath += "/"
  274. }
  275. if !strings.HasPrefix(s.SubPath, "/") {
  276. s.SubPath = "/" + s.SubPath
  277. }
  278. if !strings.HasSuffix(s.SubPath, "/") {
  279. s.SubPath += "/"
  280. }
  281. if !strings.HasPrefix(s.SubJsonPath, "/") {
  282. s.SubJsonPath = "/" + s.SubJsonPath
  283. }
  284. if !strings.HasSuffix(s.SubJsonPath, "/") {
  285. s.SubJsonPath += "/"
  286. }
  287. if !strings.HasPrefix(s.SubClashPath, "/") {
  288. s.SubClashPath = "/" + s.SubClashPath
  289. }
  290. if !strings.HasSuffix(s.SubClashPath, "/") {
  291. s.SubClashPath += "/"
  292. }
  293. if err := checkIPOrCIDRList(s.TrustedProxyCIDRs, "trusted proxy CIDR is not valid:"); err != nil {
  294. return err
  295. }
  296. // Rejected here rather than skipped at scan time: a typo in an allowlist
  297. // entry silently leaves the address unprotected until a trusted network gets banned.
  298. if err := CheckNetipAddrOrPrefixList(s.IpLimitAllowlist, "IP limit allowlist entry is not valid:"); err != nil {
  299. return err
  300. }
  301. _, err := time.LoadLocation(s.TimeLocation)
  302. if err != nil {
  303. return common.NewError("time location not exist:", s.TimeLocation)
  304. }
  305. if s.SmtpFrom != "" {
  306. if _, err := mail.ParseAddress(s.SmtpFrom); err != nil {
  307. return common.NewError("SMTP from address is not valid:", s.SmtpFrom)
  308. }
  309. }
  310. return nil
  311. }
  312. // listenAddressesConflict reports whether two listen addresses on the same port
  313. // would collide at bind time. A wildcard listen ("", "0.0.0.0", "::") overlaps
  314. // every address, so it conflicts with anything on that port; two specific
  315. // addresses conflict only when identical.
  316. func listenAddressesConflict(a, b string) bool {
  317. if a == b {
  318. return true
  319. }
  320. return isWildcardListen(a) || isWildcardListen(b)
  321. }
  322. func isWildcardListen(listen string) bool {
  323. if listen == "" {
  324. return true
  325. }
  326. if ip := net.ParseIP(listen); ip != nil {
  327. return ip.IsUnspecified()
  328. }
  329. return false
  330. }
  331. type HostGroup struct {
  332. GroupId string `json:"groupId"`
  333. InboundIds []int `json:"inboundIds" validate:"required,min=1"`
  334. Hosts []string `json:"hosts" validate:"omitempty"`
  335. SortOrder int `json:"sortOrder"`
  336. Remark string `json:"remark" validate:"required,max=256"`
  337. ServerDescription string `json:"serverDescription" validate:"omitempty,max=64"`
  338. IsDisabled bool `json:"isDisabled"`
  339. IsHidden bool `json:"isHidden"`
  340. Tags []string `json:"tags"`
  341. Port int `json:"port" validate:"gte=0,lte=65535"`
  342. Security string `json:"security" validate:"omitempty,oneof=same tls none reality"`
  343. Sni string `json:"sni"`
  344. HostHeader string `json:"hostHeader"`
  345. Path string `json:"path"`
  346. Alpn []string `json:"alpn"`
  347. Fingerprint string `json:"fingerprint"`
  348. CipherSuites string `json:"cipherSuites"`
  349. OverrideSniFromAddress bool `json:"overrideSniFromAddress"`
  350. KeepSniBlank bool `json:"keepSniBlank"`
  351. PinnedPeerCertSha256 []string `json:"pinnedPeerCertSha256"`
  352. VerifyPeerCertByName string `json:"verifyPeerCertByName"`
  353. AllowInsecure bool `json:"allowInsecure"`
  354. EchConfigList string `json:"echConfigList"`
  355. MuxParams string `json:"muxParams"`
  356. SockoptParams string `json:"sockoptParams"`
  357. FinalMask string `json:"finalMask"`
  358. VlessRoute string `json:"vlessRoute"`
  359. ExcludeFromSubTypes []string `json:"excludeFromSubTypes"`
  360. NodeGuids []string `json:"nodeGuids"`
  361. MihomoIpVersion string `json:"mihomoIpVersion" validate:"omitempty,oneof=dual ipv4 ipv6 ipv4-prefer ipv6-prefer"`
  362. MihomoX25519 bool `json:"mihomoX25519"`
  363. ShuffleHost bool `json:"shuffleHost"`
  364. }