mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
wip vip
Change-Id: Ibbd8f5f08d4614d9e92c245b8da25f3f6f19319e
This commit is contained in:
parent
af5a845a87
commit
230c0eaee6
@ -161,6 +161,7 @@ type serveEnv struct {
|
|||||||
tlsTerminatedTCP uint // a TLS terminated TCP port
|
tlsTerminatedTCP uint // a TLS terminated TCP port
|
||||||
subcmd serveMode // subcommand
|
subcmd serveMode // subcommand
|
||||||
yes bool // update without prompt
|
yes bool // update without prompt
|
||||||
|
service string // listen on a virtual service IP
|
||||||
|
|
||||||
lc localServeClient // localClient interface, specific to serve
|
lc localServeClient // localClient interface, specific to serve
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ func newServeV2Command(e *serveEnv, subcmd serveMode) *ffcli.Command {
|
|||||||
fs.UintVar(&e.tcp, "tcp", 0, "Expose a TCP forwarder to forward raw TCP packets at the specified port")
|
fs.UintVar(&e.tcp, "tcp", 0, "Expose a TCP forwarder to forward raw TCP packets at the specified port")
|
||||||
fs.UintVar(&e.tlsTerminatedTCP, "tls-terminated-tcp", 0, "Expose a TCP forwarder to forward TLS-terminated TCP packets at the specified port")
|
fs.UintVar(&e.tlsTerminatedTCP, "tls-terminated-tcp", 0, "Expose a TCP forwarder to forward TLS-terminated TCP packets at the specified port")
|
||||||
fs.BoolVar(&e.yes, "yes", false, "Update without interactive prompts (default false)")
|
fs.BoolVar(&e.yes, "yes", false, "Update without interactive prompts (default false)")
|
||||||
|
fs.StringVar(&e.service, "service", "", "listen for connections on a virtual service IP (example: service:myservice)")
|
||||||
}),
|
}),
|
||||||
UsageFunc: usageFuncNoDefaultValues,
|
UsageFunc: usageFuncNoDefaultValues,
|
||||||
Subcommands: []*ffcli.Command{
|
Subcommands: []*ffcli.Command{
|
||||||
|
12
ipn/serve.go
12
ipn/serve.go
@ -24,9 +24,7 @@ func ServeConfigKey(profileID ProfileID) StateKey {
|
|||||||
return StateKey("_serve/" + profileID)
|
return StateKey("_serve/" + profileID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServeConfig is the JSON type stored in the StateStore for
|
type ListenerConfig struct {
|
||||||
// StateKey "_serve/$PROFILE_ID" as returned by ServeConfigKey.
|
|
||||||
type ServeConfig struct {
|
|
||||||
// TCP are the list of TCP port numbers that tailscaled should handle for
|
// TCP are the list of TCP port numbers that tailscaled should handle for
|
||||||
// the Tailscale IP addresses. (not subnet routers, etc)
|
// the Tailscale IP addresses. (not subnet routers, etc)
|
||||||
TCP map[uint16]*TCPPortHandler `json:",omitempty"`
|
TCP map[uint16]*TCPPortHandler `json:",omitempty"`
|
||||||
@ -34,6 +32,14 @@ type ServeConfig struct {
|
|||||||
// Web maps from "$SNI_NAME:$PORT" to a set of HTTP handlers
|
// Web maps from "$SNI_NAME:$PORT" to a set of HTTP handlers
|
||||||
// keyed by mount point ("/", "/foo", etc)
|
// keyed by mount point ("/", "/foo", etc)
|
||||||
Web map[HostPort]*WebServerConfig `json:",omitempty"`
|
Web map[HostPort]*WebServerConfig `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServeConfig is the JSON type stored in the StateStore for
|
||||||
|
// StateKey "_serve/$PROFILE_ID" as returned by ServeConfigKey.
|
||||||
|
type ServeConfig struct {
|
||||||
|
ListenerConfig // local config
|
||||||
|
|
||||||
|
Services map[string]ListenerConfig `json:",omitempty"` // VIP service config
|
||||||
|
|
||||||
// AllowFunnel is the set of SNI:port values for which funnel
|
// AllowFunnel is the set of SNI:port values for which funnel
|
||||||
// traffic is allowed, from trusted ingress peers.
|
// traffic is allowed, from trusted ingress peers.
|
||||||
|
@ -2346,6 +2346,9 @@ const (
|
|||||||
// NodeAttrSSHEnvironmentVariables enables logic for handling environment variables sent
|
// NodeAttrSSHEnvironmentVariables enables logic for handling environment variables sent
|
||||||
// via SendEnv in the SSH server and applying them to the SSH session.
|
// via SendEnv in the SSH server and applying them to the SSH session.
|
||||||
NodeAttrSSHEnvironmentVariables NodeCapability = "ssh-env-vars"
|
NodeAttrSSHEnvironmentVariables NodeCapability = "ssh-env-vars"
|
||||||
|
|
||||||
|
// NodeAttrVIPService instructs the client how to configure VIP services.
|
||||||
|
NodeAttrVIPService NodeCapability = "vip-service"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetDNSRequest is a request to add a DNS record.
|
// SetDNSRequest is a request to add a DNS record.
|
||||||
@ -2824,3 +2827,10 @@ type EarlyNoise struct {
|
|||||||
// For some request types, the header may have multiple values. (e.g. OldNodeKey
|
// For some request types, the header may have multiple values. (e.g. OldNodeKey
|
||||||
// vs NodeKey)
|
// vs NodeKey)
|
||||||
const LBHeader = "Ts-Lb"
|
const LBHeader = "Ts-Lb"
|
||||||
|
|
||||||
|
type VIPServicePortMap map[ /*proto*/ int]map[ /*port*/ int]netip.AddrPort
|
||||||
|
|
||||||
|
type VIPService struct {
|
||||||
|
Addrs []netip.Addr `json:"addrs,omitempty"`
|
||||||
|
PortMap VIPServicePortMap `json:"portMap,omitempty"`
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gaissmai/bart"
|
||||||
"github.com/tailscale/wireguard-go/conn"
|
"github.com/tailscale/wireguard-go/conn"
|
||||||
"gvisor.dev/gvisor/pkg/refs"
|
"gvisor.dev/gvisor/pkg/refs"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
@ -173,6 +174,10 @@ type Impl struct {
|
|||||||
// It can only be set before calling Start.
|
// It can only be set before calling Start.
|
||||||
ProcessSubnets bool
|
ProcessSubnets bool
|
||||||
|
|
||||||
|
// ServiceVIPs is the description of service VIPs that should be handled.
|
||||||
|
// It can only be set before calling Start and is immutable after.
|
||||||
|
ServiceVIPs bart.Table[map[int]netip.AddrPort]
|
||||||
|
|
||||||
ipstack *stack.Stack
|
ipstack *stack.Stack
|
||||||
linkEP *linkEndpoint
|
linkEP *linkEndpoint
|
||||||
tundev *tstun.Wrapper
|
tundev *tstun.Wrapper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user