A golang webfinger server implementation
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.md 1.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # go-webfinger
  2. go-webfinger is a golang webfinger server implementation.
  3. ## Usage
  4. `webfinger.Service` is implemented as a net/http handler, which means
  5. usage is simply registering the object with your http service.
  6. Using the webfinger service as the main ServeHTTP:
  7. ```go
  8. myResolver = ...
  9. wf := webfinger.Default(myResolver{})
  10. wf.NotFoundHandler = // the rest of your app
  11. http.ListenAndService(":8080", wf)
  12. ```
  13. Using the webfinger service as a route on an existing HTTP router:
  14. ```go
  15. myResolver = ...
  16. wf := webfinger.Default(myResolver{})
  17. http.Handle(webfinger.WebFingerPath, http.HandlerFunc(wf.Webfinger))
  18. http.ListenAndService(":8080", nil)
  19. ```
  20. ## Defaults
  21. The webfinger service is installed with a few defaults. Some of these
  22. defaults ensure we stick closely to the webfinger specification (tls-only, CORS, Content-Type)
  23. and other defaults are simply useful for development (no-cache)
  24. The full list of defaults can be found in the godoc for `webfinger.Service`. They are exposed
  25. as public variables which can be overriden.
  26. `PreHandlers` are the list of preflight HTTP handlers to run. You can add your own via `wf.PreHandlers["my-custom-name"] = ...`, however,
  27. execution order is not guaranteed.
  28. ### TLS-Only
  29. Handler which routes to the TLS version of the page. Disable via `wf.NoTLSHandler = nil`.
  30. ### No-Cache
  31. A PreFlight handler which sets no-cache headers on anything under `/.well-known/webfinger`. Disable or override via `wf.PreHandlers[webfinger.NoCacheMiddleware]`
  32. ### Content Type as application/jrd+json
  33. A PreFlight handler which sets the Content-Type to `application/jrd+json`. Disable or override via `wf.PreHandlers[webfinger.ContentTypeMiddleware]`.
  34. ### CORS
  35. A PreFlight handler which adds the CORS headers. Disable or override via `wf.PreHandlers[webfinger.CorsMiddleware].`