Documentation
¶
Overview ¶
Package k8s resolves the k8s:// addresses of mediactl and the stunnerd tunnel from a Kubernetes cluster, through the kubeconfig of the caller:
k8s://<namespace>/<gateway>[/<listener>] the public address of a listener of a STUNner
Gateway, read from its served dataplane config
k8s://<namespace>/<service>:<port> the first ready pod of a Service, at the target
port of the Service port of that number or name
The argument an address is given for decides which form it takes. The listener may be left out when the Gateway has a single one, and an empty namespace (k8s:///...) is the namespace of the kubeconfig context. A TURN listener resolves to its TURN URI too, with the credentials of its auth policy.
Index ¶
- Constants
- func IsAddress(addr string) bool
- type Listener
- type Resolver
- func (r Resolver) Address(ctx context.Context, addr string) (string, error)
- func (r Resolver) Listener(ctx context.Context, addr string) (Listener, error)
- func (r Resolver) Peer(ctx context.Context, addr string) (stnrv2.Protocol, string, error)
- func (r Resolver) TURNDialer(ctx context.Context, addr string) (turn.Dialer, error)
Constants ¶
const Scheme = "k8s://"
Scheme is the prefix of the addresses this package resolves.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Listener ¶
type Listener struct {
// Addr is the public host:port of the listener.
Addr string
// TURN is the TURN URI of a TURN listener, with credentials; nil for other listeners.
TURN *stnrv2.URI
// Config is the listener's config.
Config stnrv2.ListenerConfig
}
Listener is a resolved Gateway listener.
type Resolver ¶
type Resolver struct {
K8s *cliopt.ConfigFlags
CDS *discovery.CDSConfigFlags
Log logging.LeveledLogger
}
Resolver resolves k8s:// addresses.
func (Resolver) Address ¶
Address resolves a k8s:// Gateway address to the listener's public host:port; any other address is returned as it is.