This commit enables user to set service backend to remote destinations, that can be a partial
URL or a full URL. The commit also prevents user to set remote destinations on linux system
when socket mark is not working. For user on any version of mac extension they can't serve a
service either. The socket mark usability is determined by a new local api.
Fixestailscale/corp#24783
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
msgServeAvailable="Available within your tailnet:"
msgServiceWaitingApproval="This machine is configured as a service proxy for %s, but approval from an admin is required. Once approved, it will be available in your Tailnet as:"
msgRunningInBackground="%s started and running in the background."
msgRunningTunService="IPv4 and IPv6 traffic to %s is being routed to your operating system."
msgDisableProxy="To disable the proxy, run: tailscale %s --%s=%d off"
msgDisableServiceProxy="To disable the proxy, run: tailscale serve --service=%s --%s=%d off"
msgDisableServiceTun="To disable the service in TUN mode, run: tailscale serve --service=%s --tun off"
msgDisableService="To remove config for the service, run: tailscale serve clear %s"
msgToExit="Press Ctrl+C to exit."
msgFunnelAvailable="Available on the internet:"
msgServeAvailable="Available within your tailnet:"
msgServiceWaitingApproval="This machine is configured as a service proxy for %s, but approval from an admin is required. Once approved, it will be available in your Tailnet as:"
msgRunningInBackground="%s started and running in the background."
msgRunningTunService="IPv4 and IPv6 traffic to %s is being routed to your operating system."
msgDisableProxy="To disable the proxy, run: tailscale %s --%s=%d off"
msgDisableServiceProxy="To disable the proxy, run: tailscale serve --service=%s --%s=%d off"
msgDisableServiceTun="To disable the service in TUN mode, run: tailscale serve --service=%s --tun off"
msgDisableService="To remove config for the service, run: tailscale serve clear %s"
msgWarnRemoteDestCompatibility="Warning: %s doesn't support connecting to remote destinations from non-default route, see tailscale.com/kb/1552/tailscale-services for detail."
msgToExit="Press Ctrl+C to exit."
)
// messageForPort returns a message for the given port based on the
@ -1134,6 +1140,77 @@ func (e *serveEnv) messageForPort(sc *ipn.ServeConfig, st *ipnstate.Status, dnsN
returnoutput.String()
}
// isRemote reports whether the given destination from serve config
// is a remote destination.
funcisRemote(targetstring)bool{
// target being a port number means it's localhost