Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(isCaptive IsCaptiveFunc, opts ...OptionsFunc) http.HandlerFunc
Handler returns a basic implementation of a Captive Portal API endpoint as described in the IETF 8908 RFC (https://tools.ietf.org/html/rfc8908)
Types ¶
type Options ¶
type Options struct { UserPortalURL string VenueInfoURL string CanExtendSession *bool SecondsRemaining SecondsRemainingFunc BytesRemaining BytesRemainingFunc }
func DefaultOptions ¶
func DefaultOptions() *Options
type OptionsFunc ¶
type OptionsFunc func(*Options)
func WithBytesRemainingFunc ¶
func WithBytesRemainingFunc(fn BytesRemainingFunc) OptionsFunc
func WithCanExtendSession ¶
func WithCanExtendSession(canExtend bool) OptionsFunc
func WithSecondsRemainingFunc ¶
func WithSecondsRemainingFunc(fn SecondsRemainingFunc) OptionsFunc
func WithUserPortalURL ¶
func WithUserPortalURL(userPortalURL string) OptionsFunc
func WithVenueInfoURL ¶
func WithVenueInfoURL(venueInfoURL string) OptionsFunc
type Response ¶
type Response struct { Captive bool `json:"captive"` UserPortalURL string `json:"user-portal-url,omitempty"` VenueInfoURL string `json:"venue-info-url,omitempty"` CanExtendSession *bool `json:"can-extend-session,omitempty"` SecondsRemaining *int `json:"seconds-remaining,omitempty"` BytesRemaining *int `json:"bytes-remaining,omitempty"` }
RFC8098 See https://tools.ietf.org/html/rfc8908 - "5. API State Structure"
Click to show internal directories.
Click to hide internal directories.