Categorygithub.com/axelrindle/proxyguy
modulepackage
0.2.0
Repository: https://github.com/axelrindle/proxyguy.git
Documentation: pkg.go.dev

# README

proxyguy

Codacy Code Quality Codacy Coverage

Dynamic proxy generator for corporate environments.

Primarily interesting for WSL users unable to use the forced proxy setting.

Usage

[!IMPORTANT] I only support Linux/WSL systems. There is no guarantee that this will work on Windows too.

Download the binary from the latest release and place it in the PATH, e.g. in /usr/local/bin.

Help is available using

proxyguy --help

Modules

The program supports several built-in "modules", extending functionality for certain other programs or services.

Each module must be enabled separately.

Maven

Will set the MAVEN_OPTS variable with the determined proxy endpoint.

Example:

-Dhttp.proxyHost=10.11.12.13 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=10.11.12.13 -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1|example.org|*.example.org

Gradle

Will modify the global properties file at $HOME/.gradle/gradle.properties and set the system properties analogous to the MAVEN_OPTS variable.

Why not set the GRADLE_OPTS variable?. Because that doesn't work when using IntelliJ IDEA. I didn't figure out why, but I guess IntelliJ executes the Gradle process with a limited set of environment variables. Setting the properties via the gradle.properties file does work.

Docker

Will modify the config file at $HOME/.docker/config.json and set or unset the proxies.default values as stated in the documentation.

Beware that this config only applies to the Docker Client and thus containers started using it.

To make the Docker Server use the proxy, use the following configuration:

  1. Create the file /etc/systemd/system/docker.service.d
[Service]
ExecStart=
ExecStart=/usr/local/bin/docker-wrapper.sh
  1. Create the file /usr/local/bin/docker-wrapper.sh:
eval $( proxyguy )
  1. Reload systemd
systemctl daemon-reload
  1. Restart the Docker service
systemctl restart docker.service

If you're not using Systemd, just make sure the Docker process sources the output of step 2.

Configuration

Configuration can be done by either using a YAML file or environment variables.

You should use the YAML file for local installations and environment variables for the Docker image.

KeyEnvironment VariableDefaultDescription
pacPACThe URL to the .pac file.
timeoutTIMEOUT1000A timeout after which proxy resolving will fail.
proxy.overridePROXY_OVERRIDEDefines a static proxy endpoint. Will disable the PAC resolution.
proxy.ignorePROXY_IGNORElocalhost,127.0.0.1Defines the value for the NO_PROXY variable, urls and hosts to directly connect to.
proxy.determine-urlPROXY_DETERMINEhttps://ubuntu.comAn url used to find the proxy endpoint to use. Should be a publicly available address.
modules.mainMODULES_MAINtrueEnable the Main module.
modules.mavenMODULES_MAVENfalseEnable the Maven module.
modules.gradleMODULES_GRADLEfalseEnable the Gradle module.
modules.dockerMODULES_DOCKERfalseEnable the Docker module.
server.addressSERVER_ADDRESS0.0.0.0On which address the server should bind.
server.portSERVER_PORT1337The port to listen on.

Bash Integration

Place the following line somewhere in your .bashrc file:

eval $( proxyguy )

The following environment variables will be automatically configured in every shell session if the Main module is enabled:

  • http_proxy
  • https_proxy
  • no_proxy
  • HTTP_PROXY
  • HTTPS_PROXY
  • NO_PROXY

Server Mode (WIP)

I'm working on a custom proxy server implementation which decides based on the connectivity to the corporate network whether to forward requests to another proxy or directly to the internet.

Start the server using

proxyguy -server

Todos

  • Documentation
  • Tests

License

MIT

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author

# Variables

No description provided by the author

# Structs

flags.