api.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package api
  2. import "net"
  3. const (
  4. // Version of the REST API, not implementation version.
  5. // See openapi.yaml for the definition.
  6. Version = "1.1.1"
  7. )
  8. // ErrorJSON is returned with "application/json" content type and non-2XX status code
  9. type ErrorJSON struct {
  10. Message string `json:"message"`
  11. }
  12. // Info is the structure returned by `GET /info`
  13. type Info struct {
  14. APIVersion string `json:"apiVersion"` // REST API version
  15. Version string `json:"version"` // Implementation version
  16. StateDir string `json:"stateDir"`
  17. ChildPID int `json:"childPID"`
  18. NetworkDriver *NetworkDriverInfo `json:"networkDriver,omitempty"`
  19. PortDriver *PortDriverInfo `json:"portDriver,omitempty"`
  20. }
  21. // NetworkDriverInfo in Info
  22. type NetworkDriverInfo struct {
  23. Driver string `json:"driver"`
  24. DNS []net.IP `json:"dns,omitempty"`
  25. ChildIP net.IP `json:"childIP,omitempty"` // since API v1.1.1 (RootlessKit v0.14.1)
  26. DynamicChildIP bool `json:"dynamicChildIP,omitempty"` // since API v1.1.1
  27. }
  28. // PortDriverInfo in Info
  29. type PortDriverInfo struct {
  30. Driver string `json:"driver"`
  31. Protos []string `json:"protos"`
  32. DisallowLoopbackChildIP bool `json:"disallowLoopbackChildIP,omitempty"` // since API v1.1.1
  33. }