libnetwork/discoverapi: use DiscoveryType for enum

This type describes the options defined as consts below it, so make
those consts typed. While updating, I also removed the use of iota
to prevent accidentally changing their values (and if this API is
implemented elsewhere)

(but mostly because I'm not a fan of iota ':))

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-11-11 12:40:08 +01:00
parent b66e501cad
commit 6b8285f965

View File

@@ -14,12 +14,9 @@ type Discover interface {
type DiscoveryType int
const (
// NodeDiscovery represents Node join/leave events provided by discovery
NodeDiscovery = iota + 1
// EncryptionKeysConfig represents the initial key(s) for performing datapath encryption
EncryptionKeysConfig
// EncryptionKeysUpdate represents an update to the datapath encryption key(s)
EncryptionKeysUpdate
NodeDiscovery DiscoveryType = 1 // NodeDiscovery represents Node join/leave events provided by discovery.
EncryptionKeysConfig DiscoveryType = 2 // EncryptionKeysConfig represents the initial key(s) for performing datapath encryption.
EncryptionKeysUpdate DiscoveryType = 3 // EncryptionKeysUpdate represents an update to the datapath encryption key(s).
)
// NodeDiscoveryData represents the structure backing the node discovery data json string