Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hakobe/paranoidhttp
Paranoidhttp provides a pre-configured http.Client that protects you from harm.
https://github.com/hakobe/paranoidhttp
go http
Last synced: 8 days ago
JSON representation
Paranoidhttp provides a pre-configured http.Client that protects you from harm.
- Host: GitHub
- URL: https://github.com/hakobe/paranoidhttp
- Owner: hakobe
- License: mit
- Created: 2015-08-03T14:16:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-11T10:38:08.000Z (over 1 year ago)
- Last Synced: 2024-06-19T21:11:28.676Z (5 months ago)
- Topics: go, http
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 37
- Watchers: 6
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Paranoidhttp
[![Build Status](https://travis-ci.org/hakobe/paranoidhttp.svg?branch=master)][travis]
[![Coverage Status](https://coveralls.io/repos/hakobe/paranoidhttp/badge.svg?branch=master)][coveralls]
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
[![GoDoc](https://godoc.org/github.com/hakobe/paranoidhttp?status.svg)][godoc][travis]: https://travis-ci.org/hakobe/paranoidhttp
[coveralls]: https://coveralls.io/r/hakobe/paranoidhttp?branch=master
[license]: https://github.com/hakobe/paranoidhttp/blob/master/LICENSE
[godoc]: https://godoc.org/github.com/hakobe/paranoidhttpParanoidhttp provides a pre-configured http.Client that protects you from harm.
## Description
Paranoidhttp is a factory of http.Client that is paranoid againt attackers.
This is useful when you create an HTTP request using inputs from possibly malicious users.The created http.Client protects you from connecting to internal IP ranges
even though redirects or DNS tricks are used.## Synopsis
```go
// use the default client for ease
res, err := paranoidhttp.DefaultClient.Get("http://www.hatena.ne.jp")// or customize the client for yourself
client, transport, dialer := paranoidhttp.NewClient()
client.Timeout = 10 * time.Second
transport.DisableCompression = true
dialer.KeepAlive = 60 * time.Second// Add an permitted ipnets with functional option
ipNet, _ := net.ParseCIDR("127.0.0.1/32")
client, _, _ := paranoidhttp.New(
paranoidhttp.PermittedIPNets(ipNet))
```## Acknowledgement
I want to thank [LWPx::ParanoidAgent](https://metacpan.org/pod/LWPx::ParanoidAgent).
## License
[MIT](./LICENSE)
## Author
[hakobe](http://github.com/hakobe)