tailcfg: add func to check for known valid ServiceProtos (#13668)

Updates tailscale/corp#23574.

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2024-10-02 22:54:02 -04:00 committed by GitHub
parent 383120c534
commit 09ec2f39b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -677,6 +677,16 @@ func (h *Hostinfo) CheckRequestTags() error {
PeerAPIDNS = ServiceProto("peerapi-dns-proxy") PeerAPIDNS = ServiceProto("peerapi-dns-proxy")
) )
// IsKnownServiceProto checks whether sp represents a known-valid value of
// ServiceProto.
func IsKnownServiceProto(sp ServiceProto) bool {
switch sp {
case TCP, UDP, PeerAPI4, PeerAPI6, PeerAPIDNS, ServiceProto("egg"):
return true
}
return false
}
// Service represents a service running on a node. // Service represents a service running on a node.
type Service struct { type Service struct {
_ structs.Incomparable _ structs.Incomparable