mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-30 19:36:32 +00:00
Compare commits
3 commits
b0ab403163
...
576827b7cb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
576827b7cb | ||
|
|
260eedf8c4 | ||
|
|
de63bf9354 |
2 changed files with 21 additions and 1 deletions
|
|
@ -317,7 +317,13 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
|
func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
|
||||||
address := s.address
|
var address string
|
||||||
|
if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" {
|
||||||
|
address = s.address
|
||||||
|
} else {
|
||||||
|
address = inbound.Listen
|
||||||
|
}
|
||||||
|
|
||||||
if inbound.Protocol != model.VLESS {
|
if inbound.Protocol != model.VLESS {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
x-ui.sh
14
x-ui.sh
|
|
@ -19,6 +19,20 @@ function LOGI() {
|
||||||
echo -e "${green}[INF] $* ${plain}"
|
echo -e "${green}[INF] $* ${plain}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Simple helpers for domain/IP validation
|
||||||
|
is_ipv4() {
|
||||||
|
[[ "$1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] && return 0 || return 1
|
||||||
|
}
|
||||||
|
is_ipv6() {
|
||||||
|
[[ "$1" =~ : ]] && return 0 || return 1
|
||||||
|
}
|
||||||
|
is_ip() {
|
||||||
|
is_ipv4 "$1" || is_ipv6 "$1"
|
||||||
|
}
|
||||||
|
is_domain() {
|
||||||
|
[[ "$1" =~ ^([A-Za-z0-9](-*[A-Za-z0-9])*\.)+[A-Za-z]{2,}$ ]] && return 0 || return 1
|
||||||
|
}
|
||||||
|
|
||||||
# check root
|
# check root
|
||||||
[[ $EUID -ne 0 ]] && LOGE "ERROR: You must be root to run this script! \n" && exit 1
|
[[ $EUID -ne 0 ]] && LOGE "ERROR: You must be root to run this script! \n" && exit 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue