http

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 6 Imported by: 0

README

go-http

Introduction

ClientIP

Returns the client ip address from HTTP headers. It is aware of True-Client-IP and CF-Connecting-IP. (both from CloudFlare)

MimeType

Provides a mapping for know filename extension to mime type (e.g. .html -> text/html) based on the built in mime.TypeByExtension and svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

Part of the source code is generated by GenMimeType.py

AcceptLanguage

Use to parse browser Accept-Language headers like fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 Please see e.g. MDN (Mozilla Developer Network) for general information on Accept-Language.

License

Release under the MIT License. (see LICENSE)

Codacy Badge

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientIP

func GetClientIP(r *http.Request) (string, error)

GetClientIP (request) Returns the client ip address from HTTP headers

func MimeTypeByExtension

func MimeTypeByExtension(extension string) string

MimeTypeByExtension (extension) Return matching MimeType for file extension

Types

type AcceptedLanguage

type AcceptedLanguage struct {
	Lang string
	Q    float64
}

AcceptedLanguage struct Language and q-factor weighting

func ParseAcceptLanguage

func ParseAcceptLanguage(acceptLanguage string) []AcceptedLanguage

ParseAcceptLanguage (acceptLanguage) Use to parse browser 'Accept-Language' header including accepted language and q-factor weighting e. g. 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5'

Jump to

Keyboard shortcuts

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