Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/theckman/httpforwarded

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/theckman/httpforwarded

  • v0.4.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

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.

FAQs

Package last updated on 11 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc