Giter VIP home page Giter VIP logo

httpforwarded's Introduction

httpforwarded

TravisCI Build Status License GoDoc

The httpforwarded go package provides utility functions for working with the Forwarded HTTP header as defined in RFC-7239. This header is proposed to replace the X-Forwarded-For and X-Forwarded-Proto headers, amongst others.

This package was heavily inspired by the mime package in the standard library, more specifically the ParseMediaType() function.

License

This package copies some functions, without modification, from the Go standard library. As such, the entirety of this package is released under the same permissive BSD-style license as the Go language itself. Please see the contents of the LICENSE file for the full details of the license.

Installing

To install this package for consumption, you can run the following:

go get -u github.com/theckman/httpforwarded

If you would like to also work on the development of httpforwarded, you can also install the testing dependencies:

go get -t -u github.com/theckman/httpforwarded

Usage

// var req *http.Request

headerValues := req.Header[http.CanonicalHeaderKey("forwarded")]

params, _ := httpforwarded.Parse(headerValues)

// you can then do something like this to get the first "for" param:
fmt.Printf("origin %s", params["for"][0])

For more information on using the package, please refer to the GoDoc page.

httpforwarded's People

Contributors

theckman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.