Giter VIP home page Giter VIP logo

go-get-proxied's Introduction

go-get-proxied - Cross platform proxy configurations

Build Status Go Report Card

Go code (golang) package which facilitates the retrieval of system proxy configurations.

Installation

  • Install this package using go get github.com/rapid7/go-get-proxied
  • Or, simply import go get github.com/rapid7/go-get-proxied, and use dep ensure to include it in your package

Usage:

package main
import (
    "fmt"
    "github.com/rapid7/go-get-proxied/proxy"
)
func main() {
    p := proxy.NewProvider("").Get("https", "https://rapid7.com")
    if p != nil {
        fmt.Printf("Found proxy: %s\n", p)
    }
}

Command Line Usage:

> ./go-get-proxied -h
Usage of ./go-get-proxied:
  -c string
    	Optional. Path to configuration file.
  -j	Optional. If a proxy is found, write it as JSON instead of a URL.
  -l	Optional. If set, a list of proxy will be returned.
  -p string
    	Optional. The proxy protocol you wish to lookup. Default: https (default "https")
  -t string
    	Optional. Target URL which the proxy will be used for. Default: *
  -v	Optional. If set, log content will be sent to stderr.
> netsh winhttp set proxy testProxy:8999

Current WinHTTP proxy settings:

    Proxy Server(s) :  testProxy:8999
    Bypass List     :  (none)
> ./go-get-proxied
//testProxy:8999
> ./go-get-proxied -j
{
   "host": "testProxy",
   "password": null,
   "port": 8999,
   "protocol": "",
   "src": "WinHTTP:WinHttpDefault",
   "username": null
}
> echo '{"https":"http://testProxy:8999"}' > proxy.config
> ./go-get-proxied -c proxy.config
http://testProxy:8999
> ./go-get-proxied -c proxy.config -j
{
   "host": "testProxy",
   "password": null,
   "port": 8999,
   "protocol": "http",
   "src": "ConfigurationFile",
   "username": null
}

Configuration:

The priority of retrieval is the following.

  • Windows:
    • Configuration File
    • Environment Variable: HTTPS_PROXY, HTTP_PROXY, FTP_PROXY, or ALL_PROXY. NO_PROXY is respected.
    • Internet Options: Automatically detect settings (WPAD)
    • Internet Options: Use automatic configuration script (PAC)
    • Internet Options: Manual proxy server
    • WINHTTP: (netsh winhttp)
  • Linux:
    • Configuration File
    • Environment Variable: HTTPS_PROXY, HTTP_PROXY, FTP_PROXY, or ALL_PROXY. NO_PROXY is respected.
  • MacOS:
    • Configuration File
    • Environment Variable: HTTPS_PROXY, HTTP_PROXY, FTP_PROXY, or ALL_PROXY. NO_PROXY is respected.
    • Network Settings: scutil

go-get-proxied's People

Contributors

bli-r7 avatar dgreene-r7 avatar ghconnector-r7 avatar kasadzadeh-r7 avatar tosmun-r7 avatar

Watchers

 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.