Documentation
¶
Overview ¶
Package edgeagent is the Edge relay's Sidecar agent, which relays TCP connections to an ingress in the emulator with a PROXY v2 header, and the LAN relay containers that run it in LAN mode on the host network: lb-lan for --lb-bind and gfe-lan, the LAN front-end relay, for --gfe-bind.
Index ¶
- Constants
- func AcceptProxied(c net.Conn) (*proxiedConn, error)
- func ProxiedListener(ln net.Listener) net.Listener
- func ReadProxyV2(r *bufio.Reader) (src, dst *net.TCPAddr, err error)
- func WriteProxyV2(w io.Writer, src, dst *net.TCPAddr, tlvs ...TLV) error
- type Config
- type LANRelay
- type Listener
- type Route
- type TLV
Constants ¶
const ( // EdgeAgentName runs the lb-edge container's agent. EdgeAgentName = "lb-edge" // LANAgentName runs the agent in LAN mode, in a LANRelay container. LANAgentName = "lb-lan" // ControlPort and RelayPort are the lb-edge agent's ports. ControlPort = 15080 RelayPort = 15081 // TokenHeader carries the control port's token. TokenHeader = "X-Gcpemu-Lb-Token" )
const Image = "rancher/k3s:v1.37.2-k3s1"
Image is the image lb-edge and the LAN relay containers run the Sidecar agent in.
Variables ¶
This section is empty.
Functions ¶
func AcceptProxied ¶
AcceptProxied reads the PROXY header of a new connection.
func ProxiedListener ¶
ProxiedListener accepts from ln only connections that start with a PROXY v2 header, which each reads in its own goroutine, and closes every other; the connections it returns have the header's addresses.
func ReadProxyV2 ¶
ReadProxyV2 parses a PROXY v2 header from r, ignoring its TLVs.
Types ¶
type Config ¶
type Config struct {
Ingress string `json:"ingress"`
Listeners []Listener `json:"listeners"`
Routes []Route `json:"routes"`
// Public are external forwarding rule addresses and ports (#187).
Public []Listener `json:"public,omitempty"`
}
Config is the desired state the emulator posts to the agent.
type LANRelay ¶
type LANRelay struct {
// Runtime returns the container runtime.
Runtime func(context.Context) (*runtime.Manager, error)
// Name names the container (gcpemu-<id>-<Name>) and its log lines.
Name string
// Service, Resource and Role label the container.
Service, Resource, Role string
// Offline: the image is not pulled.
Offline bool
Log *slog.Logger
// contains filtered or unexported fields
}
LANRelay manages a LAN relay container: on the host network, with NET_BIND_SERVICE, it runs the agent in LAN mode, listens on host addresses on ports the emulator cannot bind (privileged ports) and relays each connection, with a PROXY v2 header, to an ingress on the host's loopback. It forwards plain TCP. The lb Service's lb-lan, the LAN load balancing relay (--lb-bind), and the Google front end's gfe-lan, the LAN front-end relay (--gfe-bind), are two.