dnsEntry.go 1015 B

1234567891011121314151617181920212223242526272829303132333435
  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. NewAddress string
  24. }
  25. // DNSEntry - a DNS entry represented as struct
  26. type DNSEntry struct {
  27. Address string `json:"address" bson:"address" validate:"ip"`
  28. Address6 string `json:"address6" bson:"address6"`
  29. Name string `json:"name" bson:"name" validate:"required,name_unique,min=1,max=192"`
  30. Network string `json:"network" bson:"network" validate:"network_exists"`
  31. }