mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-01 20:48:39 +00:00
replace all assemble of host name for service with strings.Join
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
This commit is contained in:
parent
8d861680d2
commit
d40755be85
@ -932,7 +932,7 @@ func (e *serveEnv) removeWebServe(sc *ipn.ServeConfig, st *ipnstate.Status, dnsN
|
||||
if svc == nil {
|
||||
return errors.New("service does not exist")
|
||||
}
|
||||
hostName = svcName.WithoutPrefix() + "." + st.CurrentTailnet.MagicDNSSuffix
|
||||
hostName = strings.Join([]string{svcName.WithoutPrefix(), st.CurrentTailnet.MagicDNSSuffix}, ".")
|
||||
webServeMap = svc.Web
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ func (sc *ServeConfig) SetWebHandler(st *ipnstate.Status, handler *HTTPHandler,
|
||||
webServerMap := &sc.Web
|
||||
hostName := host
|
||||
if svcName, ok := tailcfg.AsServiceName(host); ok {
|
||||
hostName = svcName.WithoutPrefix() + "." + st.CurrentTailnet.MagicDNSSuffix
|
||||
hostName = strings.Join([]string{svcName.WithoutPrefix(), st.CurrentTailnet.MagicDNSSuffix}, ".")
|
||||
if _, ok := sc.Services[svcName]; !ok {
|
||||
mak.Set(&sc.Services, svcName, new(ServiceConfig))
|
||||
}
|
||||
@ -458,8 +458,8 @@ func (sc *ServeConfig) RemoveWebHandler(host string, port uint16, mounts []strin
|
||||
// RemoveServiceWebHandler deletes the web handlers at all of the given mount points
|
||||
// for the provided host and port in the serve config for the given service.
|
||||
func (sc *ServeConfig) RemoveServiceWebHandler(st *ipnstate.Status, svcName tailcfg.ServiceName, port uint16, mounts []string) {
|
||||
dnsNameForService := svcName.WithoutPrefix() + "." + st.CurrentTailnet.MagicDNSSuffix
|
||||
hp := HostPort(net.JoinHostPort(dnsNameForService, strconv.Itoa(int(port))))
|
||||
hostName := strings.Join([]string{svcName.WithoutPrefix(), st.CurrentTailnet.MagicDNSSuffix}, ".")
|
||||
hp := HostPort(net.JoinHostPort(hostName, strconv.Itoa(int(port))))
|
||||
|
||||
svc, ok := sc.Services[svcName]
|
||||
if !ok || svc == nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user