mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-06 18:06:36 +08:00
fix(backend): 修复转发监听 IP 为 IPv6 时报missing port in address (#397)
* fix(backend): handle IPv6 forward bind IP ports * test(handler): add IPv6 bindIP test cases for forward service config --------- Co-authored-by: sagit <36596628+Sagit-chu@users.noreply.github.com> Co-authored-by: sagitchu <sagitchu@gmail.com>
This commit is contained in:
@@ -1577,10 +1577,11 @@ func buildForwardServiceConfigs(baseName string, forward *forwardRecord, tunnel
|
||||
}
|
||||
var serviceAddr string
|
||||
if bindIP != "" {
|
||||
if strings.Contains(bindIP, ":") {
|
||||
serviceAddr = processServerAddress(bindIP)
|
||||
trimmedBindIP := strings.TrimSpace(bindIP)
|
||||
if _, _, err := net.SplitHostPort(trimmedBindIP); err == nil {
|
||||
serviceAddr = processServerAddress(trimmedBindIP)
|
||||
} else {
|
||||
serviceAddr = processServerAddress(fmt.Sprintf("%s:%d", bindIP, port))
|
||||
serviceAddr = processServerAddress(net.JoinHostPort(strings.Trim(trimmedBindIP, "[]"), strconv.Itoa(port)))
|
||||
}
|
||||
} else {
|
||||
serviceAddr = processServerAddress(fmt.Sprintf("%s:%d", listenerAddr, port))
|
||||
|
||||
Reference in New Issue
Block a user