labels.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package netlabel
  2. import "strings"
  3. const (
  4. // Prefix constant marks the reserved label space for libnetwork
  5. Prefix = "com.docker.network"
  6. // DriverPrefix constant marks the reserved label space for libnetwork drivers
  7. DriverPrefix = Prefix + ".driver"
  8. // GenericData constant that helps to identify an option as a Generic constant
  9. GenericData = Prefix + ".generic"
  10. // PortMap constant represents Port Mapping
  11. PortMap = Prefix + ".portmap"
  12. // MacAddress constant represents Mac Address config of a Container
  13. MacAddress = Prefix + ".endpoint.macaddress"
  14. // ExposedPorts constant represents exposedports of a Container
  15. ExposedPorts = Prefix + ".endpoint.exposedports"
  16. //EnableIPv6 constant represents enabling IPV6 at network level
  17. EnableIPv6 = Prefix + ".enable_ipv6"
  18. // KVProvider constant represents the KV provider backend
  19. KVProvider = DriverPrefix + ".kv_provider"
  20. // KVProviderURL constant represents the KV provider URL
  21. KVProviderURL = DriverPrefix + ".kv_provider_url"
  22. // KVProviderConfig constant represents the KV provider Config
  23. KVProviderConfig = DriverPrefix + ".kv_provider_config"
  24. // OverlayBindInterface constant represents overlay driver bind interface
  25. OverlayBindInterface = DriverPrefix + ".overlay.bind_interface"
  26. // OverlayNeighborIP constant represents overlay driver neighbor IP
  27. OverlayNeighborIP = DriverPrefix + ".overlay.neighbor_ip"
  28. // Gateway represents the gateway for the network
  29. Gateway = Prefix + ".gateway"
  30. )
  31. // Key extracts the key portion of the label
  32. func Key(label string) string {
  33. kv := strings.SplitN(label, "=", 2)
  34. return kv[0]
  35. }
  36. // Value extracts the value portion of the label
  37. func Value(label string) string {
  38. kv := strings.SplitN(label, "=", 2)
  39. return kv[1]
  40. }