protocol.go 889 B

12345678910111213141516171819202122
  1. package protocol
  2. ////////////////////////////////////////////////////////////////////////////////
  3. //
  4. // The purpose of this package is to provide a general set of utilities for
  5. // writing responses in networked communication. Since go often uses the basic
  6. // protocol names (ie: "net/http") for their packages, keeping protocol utilities
  7. // in their own packages can be a bit annoying with respect to building an API.
  8. // To provide a "static" set of utilities, we can utilize method selectors on
  9. // structs allowing callers to use proto.<protocol>() to access the utility methods
  10. // with package-like syntax. We can also expand on the supported protocols as needed.
  11. //
  12. ////////////////////////////////////////////////////////////////////////////////
  13. var (
  14. httpProtocol HTTPProtocol
  15. )
  16. // HTTP returns the HTTPProtocol utilities.
  17. func HTTP() HTTPProtocol {
  18. return httpProtocol
  19. }