domain.go 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package future
  2. import (
  3. "code.osinet.fr/fgm/kurz/domain"
  4. "net/url"
  5. )
  6. /*
  7. Domain represents a DNS domain.
  8. */
  9. type Domain interface {
  10. String() string
  11. }
  12. /*
  13. HTTPStatus is a subset of int limited to the values enumerated in net/http,
  14. like StatusOK (200) or StatusNotFound (404).
  15. */
  16. type HTTPStatus interface {
  17. Int() int
  18. }
  19. /**
  20. HTTPRedirectStatus is a subset of HTTPStatus limited to the values from 300 to 399.
  21. */
  22. type HTTPRedirectStatus HTTPStatus
  23. type ShortURLAssigner interface {
  24. GenerateShortURLFromTarget(TargetURL, DomainController) (domain.ShortURL, error)
  25. RegisterShortURLForTarget(domain.ShortURL, TargetURL, DomainController) error
  26. }
  27. type ShortURLResolver interface {
  28. TargetURLFromShortURL(domain.ShortURL) (TargetURL, error)
  29. }
  30. type TargetURL interface {
  31. AllowedRedirectStatuses() []HTTPRedirectStatus
  32. DefaultRedirectStatus() HTTPRedirectStatus
  33. RedirectURL() url.URL
  34. }
  35. type DomainController interface {
  36. ControlledDomains() []Domain
  37. }