Documentation ¶
Index ¶
- Constants
- func Command() *cobra.Command
- func WithNewServiceFunc(ctx context.Context, f NewServiceFunc) context.Context
- func WithNewSessionFunc(ctx context.Context, f NewSessionFunc) context.Context
- type InProcSession
- func (rd *InProcSession) Connect(ctx context.Context, in *rpc.OutboundInfo, opts ...grpc.CallOption) (*rpc.DaemonStatus, error)
- func (rd *InProcSession) Disconnect(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
- func (rd *InProcSession) GetNetworkConfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*rpc.NetworkConfig, error)
- func (rd *InProcSession) Quit(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
- func (rd *InProcSession) SetDNSExcludes(ctx context.Context, in *rpc.SetDNSExcludesRequest, opts ...grpc.CallOption) (*empty.Empty, error)
- func (rd *InProcSession) SetDNSMappings(ctx context.Context, in *rpc.SetDNSMappingsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
- func (rd *InProcSession) SetDnsSearchPath(ctx context.Context, paths *rpc.Paths, opts ...grpc.CallOption) (*empty.Empty, error)
- func (rd *InProcSession) SetLogLevel(ctx context.Context, in *manager.LogLevelRequest, opts ...grpc.CallOption) (*empty.Empty, error)
- func (rd *InProcSession) Status(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*rpc.DaemonStatus, error)
- func (rd *InProcSession) Version(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*common.VersionInfo, error)
- func (rd *InProcSession) WaitForNetwork(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
- type NewServiceFunc
- type NewSessionFunc
- type Service
- func (s *Service) As(ptr any)
- func (s *Service) Connect(ctx context.Context, info *rpc.OutboundInfo) (*rpc.DaemonStatus, error)
- func (s *Service) Disconnect(ctx context.Context, _ *empty.Empty) (*empty.Empty, error)
- func (s *Service) GetNetworkConfig(ctx context.Context, e *empty.Empty) (nc *rpc.NetworkConfig, err error)
- func (s *Service) Quit(ctx context.Context, _ *empty.Empty) (*empty.Empty, error)
- func (s *Service) SetDNSExcludes(ctx context.Context, req *rpc.SetDNSExcludesRequest) (*emptypb.Empty, error)
- func (s *Service) SetDNSMappings(ctx context.Context, req *rpc.SetDNSMappingsRequest) (*emptypb.Empty, error)
- func (s *Service) SetDnsSearchPath(ctx context.Context, paths *rpc.Paths) (*empty.Empty, error)
- func (s *Service) SetLogLevel(ctx context.Context, request *manager.LogLevelRequest) (*empty.Empty, error)
- func (s *Service) Status(_ context.Context, _ *empty.Empty) (*rpc.DaemonStatus, error)
- func (s *Service) Version(_ context.Context, _ *empty.Empty) (*common.VersionInfo, error)
- func (s *Service) WaitForNetwork(ctx context.Context, e *empty.Empty) (*empty.Empty, error)
- func (s *Service) WithSession(f func(context.Context, *Session) error) error
- type Session
- func (s *Session) Done() chan struct{}
- func (s *Session) SetExcludes(ctx context.Context, excludes []string)
- func (s *Session) SetMappings(ctx context.Context, mappings []*rpc.DNSMapping)
- func (s *Session) SetSearchPath(ctx context.Context, paths []string, namespaces []string)
- func (s *Session) Start(c context.Context, g *dgroup.Group) error
Constants ¶
const (
ProcessName = "daemon"
)
Variables ¶
This section is empty.
Functions ¶
func WithNewServiceFunc ¶ added in v2.9.0
func WithNewServiceFunc(ctx context.Context, f NewServiceFunc) context.Context
func WithNewSessionFunc ¶ added in v2.9.0
func WithNewSessionFunc(ctx context.Context, f NewSessionFunc) context.Context
Types ¶
type InProcSession ¶ added in v2.11.0
type InProcSession struct { *Session // contains filtered or unexported fields }
InProcSession is like Session, but also implements the daemon.DaemonClient interface. This makes it possible to use the session in-process from the user daemon, without starting the root daemon gRPC service.
func NewInProcSession ¶ added in v2.11.0
func NewInProcSession( ctx context.Context, scout *scout.Reporter, mi *rpc.OutboundInfo, mc manager.ManagerClient, ver semver.Version, ) *InProcSession
NewInProcSession returns a root daemon session suitable to use in-process (from the user daemon) and is primarily intended for when the user daemon runs in a docker container with NET_ADMIN capabilities.
func (*InProcSession) Connect ¶ added in v2.11.0
func (rd *InProcSession) Connect(ctx context.Context, in *rpc.OutboundInfo, opts ...grpc.CallOption) (*rpc.DaemonStatus, error)
func (*InProcSession) Disconnect ¶ added in v2.11.0
func (rd *InProcSession) Disconnect(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
func (*InProcSession) GetNetworkConfig ¶ added in v2.11.0
func (rd *InProcSession) GetNetworkConfig(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*rpc.NetworkConfig, error)
func (*InProcSession) Quit ¶ added in v2.11.0
func (rd *InProcSession) Quit(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
func (*InProcSession) SetDNSExcludes ¶ added in v2.14.0
func (rd *InProcSession) SetDNSExcludes(ctx context.Context, in *rpc.SetDNSExcludesRequest, opts ...grpc.CallOption) (*empty.Empty, error)
func (*InProcSession) SetDNSMappings ¶ added in v2.14.0
func (rd *InProcSession) SetDNSMappings(ctx context.Context, in *rpc.SetDNSMappingsRequest, opts ...grpc.CallOption) (*empty.Empty, error)
func (*InProcSession) SetDnsSearchPath ¶ added in v2.11.0
func (rd *InProcSession) SetDnsSearchPath(ctx context.Context, paths *rpc.Paths, opts ...grpc.CallOption) (*empty.Empty, error)
func (*InProcSession) SetLogLevel ¶ added in v2.11.0
func (rd *InProcSession) SetLogLevel(ctx context.Context, in *manager.LogLevelRequest, opts ...grpc.CallOption) (*empty.Empty, error)
func (*InProcSession) Status ¶ added in v2.11.0
func (rd *InProcSession) Status(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*rpc.DaemonStatus, error)
func (*InProcSession) Version ¶ added in v2.11.0
func (rd *InProcSession) Version(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*common.VersionInfo, error)
func (*InProcSession) WaitForNetwork ¶ added in v2.11.0
func (rd *InProcSession) WaitForNetwork(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
type NewServiceFunc ¶ added in v2.9.0
func GetNewServiceFunc ¶ added in v2.9.0
func GetNewServiceFunc(ctx context.Context) NewServiceFunc
type NewSessionFunc ¶ added in v2.9.0
func GetNewSessionFunc ¶ added in v2.9.0
func GetNewSessionFunc(ctx context.Context) NewSessionFunc
type Service ¶ added in v2.9.0
type Service struct { rpc.UnsafeDaemonServer // contains filtered or unexported fields }
Service represents the state of the Telepresence Daemon.
func (*Service) Connect ¶ added in v2.9.0
func (s *Service) Connect(ctx context.Context, info *rpc.OutboundInfo) (*rpc.DaemonStatus, error)
func (*Service) Disconnect ¶ added in v2.9.0
func (*Service) GetNetworkConfig ¶ added in v2.9.0
func (*Service) SetDNSExcludes ¶ added in v2.14.0
func (*Service) SetDNSMappings ¶ added in v2.14.0
func (*Service) SetDnsSearchPath ¶ added in v2.9.0
func (*Service) SetLogLevel ¶ added in v2.9.0
func (*Service) WaitForNetwork ¶ added in v2.9.0
type Session ¶ added in v2.9.0
type Session struct {
// contains filtered or unexported fields
}
Session resolves DNS names and routes outbound traffic that is centered around a TUN device. The router is similar to a TUN-to-SOCKS5 but uses a bidirectional gRPC muxTunnel instead of SOCKS when communicating with the traffic-manager. The addresses of the device are derived from IP addresses sent to it from the user daemon (which in turn receives them from the cluster).
Data sent to the device is received as L3 IP-packets and parsed into L4 UDP and TCP before they are dispatched over the muxTunnel. Returned payloads are wrapped as IP-packets before written back to the device. This L3 <=> L4 conversation is made using gvisor.dev/gvisor/pkg/tcpip.
Connection pooling:
For UDP and TCP packets, a ConnID is created which uniquely identifies a combination of protocol, source IP, source port, destination IP, and destination port. A handler is then obtained that matches that ID (active handlers are cached in a tunnel.Pool) and the packet is then sent to that handler. The handler typically sends the ConnID and the payload of the packet over to the traffic-manager using the gRPC ClientTunnel. At the receiving en din the traffic-manager, a similar tunnel.Pool obtains a corresponding handler which manages a net.Conn matching the ConnID in the cluster.
A zero Session is invalid; you must use newSession.
func NewSession ¶ added in v2.9.0
NewSession returns a new properly initialized session object.
func (*Session) SetExcludes ¶ added in v2.14.0
func (*Session) SetMappings ¶ added in v2.14.0
func (s *Session) SetMappings(ctx context.Context, mappings []*rpc.DNSMapping)