unwind

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package unwind Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package unwind Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package unwind Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package unwind Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package unwind Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package unwind Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

ClientIP returns the client's real IP address from the request. It considers X-Forwarded-For, X-Real-IP, and RemoteAddr headers.

Types

type Context

type Context struct {
	Writer http.ResponseWriter
	Req    *http.Request
	// contains filtered or unexported fields
}

Context holds request-scope data and provides helper methods.

func (*Context) Abort

func (c *Context) Abort()

Abort stops execution of remaining handlers.

func (*Context) Context

func (c *Context) Context() context.Context

Context returns the request's context

func (*Context) Cookie

func (c *Context) Cookie(name string) (string, error)

Cookie gets the value of a named cookie from the request. Returns empty string and error if not found.

func (*Context) Delete

func (c *Context) Delete(key string)

Delete removes a value from the context by its key.

func (*Context) DeleteCookie

func (c *Context) DeleteCookie(name string)

DeleteCookie removes a cookie by setting it to expired.

func (*Context) Get

func (c *Context) Get(key string) (any, bool)

Get retrieves a value from the request context.

func (*Context) GetString

func (c *Context) GetString(key string) (string, bool)

GetString is a convenience wrapper to retrieve and assert a string value.

func (*Context) Header

func (c *Context) Header(key string) string

Header returns the value of a request header.

func (*Context) Host

func (c *Context) Host() string

Host to get the host of the request

func (*Context) IsAborted

func (c *Context) IsAborted() bool

IsAborted reports whether the handler chain has been aborted.

func (*Context) Method

func (c *Context) Method() string

Method to get the HTTP method of the request

func (*Context) Next

func (c *Context) Next()

Next invokes the next handler in the chain.

func (*Context) Param

func (c *Context) Param(key string) string

Param returns the value of a named route parameter.

func (*Context) Params

func (c *Context) Params() map[string]string

Params returns the Context params.

func (*Context) Path

func (c *Context) Path() string

Path to get the full normalized path of the request

func (*Context) QueryAll

func (c *Context) QueryAll() url.Values

QueryAll returns the full parsed query values.

func (*Context) QueryParam

func (c *Context) QueryParam(key string) string

QueryParam returns the first value for the named query parameter.

func (*Context) Scheme

func (c *Context) Scheme() string

Scheme to get the scheme of the request

func (*Context) Set

func (c *Context) Set(key string, value any)

Set stores a value in the request context.

func (*Context) SetCookie

func (c *Context) SetCookie(cookie *http.Cookie)

SetCookie sets a cookie in the response.

func (*Context) SetHeader

func (c *Context) SetHeader(key, value string)

SetHeader sets a response header.

func (*Context) Status

func (c *Context) Status(code int)

Status sets the HTTP status code (does not write headers yet).

func (*Context) URL

func (c *Context) URL() string

URL to get the full URL (scheme://host/path?query)

type HandlerFunc

type HandlerFunc func(*Context)

HandlerFunc defines the handler used by router.

func Logger

func Logger() HandlerFunc

func Recover

func Recover() HandlerFunc

type Unwind

type Unwind struct {
	// contains filtered or unexported fields
}

func New

func New() *Unwind

func (*Unwind) Run

func (an *Unwind) Run(addr ...string)

func (*Unwind) RunTLS

func (an *Unwind) RunTLS(addr, certFile, keyFile string)

func (*Unwind) Stop

func (an *Unwind) Stop()

func (*Unwind) WithLogger

func (an *Unwind) WithLogger() *Unwind

func (*Unwind) WithServer

func (an *Unwind) WithServer(server *http.Server) *Unwind

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL