dnsEntry.go 984 B

12345678910111213141516171819202122232425262728293031323334
  1. // TODO: Either add a returnNetwork and returnKey, or delete this
  2. package models
  3. // DNSUpdateAction identifies the action to be performed with the dns update data
  4. type DNSUpdateAction int
  5. const (
  6. // DNSDeleteByIP delete the dns entry
  7. DNSDeleteByIP = iota
  8. // DNSDeleteByName delete the dns entry
  9. DNSDeleteByName
  10. // DNSReplaceName replace the dns entry
  11. DNSReplaceName
  12. // DNSReplaceIP resplace the dns entry
  13. DNSReplaceIP
  14. // DNSInsert insert a new dns entry
  15. DNSInsert
  16. )
  17. // DNSUpdate data for updating entries in /etc/hosts
  18. type DNSUpdate struct {
  19. Action DNSUpdateAction
  20. Name string
  21. NewName string
  22. Address string
  23. }
  24. // DNSEntry - a DNS entry represented as struct
  25. type DNSEntry struct {
  26. Address string `json:"address" bson:"address" validate:"ip"`
  27. Address6 string `json:"address6" bson:"address6"`
  28. Name string `json:"name" bson:"name" validate:"required,name_unique,min=1,max=192"`
  29. Network string `json:"network" bson:"network" validate:"network_exists"`
  30. }