// Package controlsock names the root instance-control channel (design // §5). It is a leaf package with no internal imports so both // internal/provision and internal/unixdial can depend on it without an // import cycle: provision already imports internal/release (for the // store), and internal/release's unix dial sites need // unixdial.Checked — which must know the control endpoint's path // without pulling provision (and therefore release) back in. package controlsock import ( "path/filepath" "strings" ) // Dir and Path are the root instance-control channel (design §5). // Deliberately NOT under provision.SocketDir: an instance's namespace // replaces /run/carlos with an empty tmpfs, and nothing an instance can // reach must resolve to this path. const ( Dir = "/run/carlos-control" Path = Dir + "/control.sock" ) // IsEndpoint reports whether path is the control channel or anything // else under its directory. The edge and the agent refuse to dial such a // path as an upstream (design §5.4): a registry row pointing at it is // refused before connect(). func IsEndpoint(path string) bool { clean := filepath.Clean(path) return clean == Dir || strings.HasPrefix(clean, Dir+"/") }