mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-02 16:01:27 +01:00
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. Fixes tailscale/corp#24783 Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
32 lines
590 B
Go
32 lines
590 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build darwin || windows
|
|
|
|
package netns
|
|
|
|
import (
|
|
"errors"
|
|
"net"
|
|
"net/netip"
|
|
)
|
|
|
|
var errUnspecifiedHost = errors.New("unspecified host")
|
|
|
|
func parseAddress(address string) (addr netip.Addr, err error) {
|
|
host, _, err := net.SplitHostPort(address)
|
|
if err != nil {
|
|
// error means the string didn't contain a port number, so use the string directly
|
|
host = address
|
|
}
|
|
if host == "" {
|
|
return addr, errUnspecifiedHost
|
|
}
|
|
|
|
return netip.ParseAddr(host)
|
|
}
|
|
|
|
func UseSocketMark() bool {
|
|
return false
|
|
}
|