Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHealth ¶
CheckHealth is a health check endpoint. It returns a 200 OK status code.
func CheckStatus ¶ added in v0.0.12
CheckStatus is a workaround to return a valid response for status.kagi.com. Status.kagi.com returns for some requests a valid response but the status is always "404". This is a workaround to return a valid response.
func Proxy ¶
func Proxy() gin.HandlerFunc
Proxy is an endpoint handler that proxies requests to the kagi.com and *.kagi.com servers. It also injects a session token into the request if it is not already present. It applies custom reverse proxy with mutation observer, CSP handling, and response compression.
func SignInForm ¶
SignInForm is a handler that authenticates the user. If the user is not authenticated, it redirects to the login page. If the user is authenticated, it redirects to the root page or the location he attempted to access before page. It supports two actions: login and signup. Login action authenticates the user with username, password, and OTP. Signup action generates a QR code for the user to set up OTP.
Types ¶
type ProxyState ¶
type ProxyState struct { // RetryConfig is the configuration for retrying requests. RetryConfig web.RetryConfig // SessionCreatedAt is the time the session was created. SessionCreatedAt time.Time // SessionId is the session ID. SessionId string }
ProxyState preserves the state of the proxy handler.
func (ProxyState) Director ¶
func (p ProxyState) Director(req *http.Request)
Director is a function that modifies the request before it is sent. It injects a session token into the request if it is not already present. It also modifies the request to use the target host specified in the targetHostConfig.
func (ProxyState) ErrorHandler ¶
func (ProxyState) ErrorHandler(w http.ResponseWriter, r *http.Request, err error)
ErrorHandler is a function that handles errors that occur during the proxying process.
func (ProxyState) ModifyResponse ¶
func (p ProxyState) ModifyResponse(resp *http.Response) error
ModifyResponse is a function that modifies the response before it is sent. It injects a script that proxies requests to the target hosts specified in the targetHostConfig.