Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/litongjava/go-http-agent

使用go语言编写的http代理程序
https://github.com/litongjava/go-http-agent

Last synced: about 1 month ago
JSON representation

使用go语言编写的http代理程序

Awesome Lists containing this project

README

        

# go-http-agent

`go-http-agent` is an HTTP proxy program written in Go language. It supports reverse proxy functionality, allowing the forwarding of client HTTP requests to a specified server and then returning the server response to the client, along with the capability to save static files locally. This proxy program supports both HTTP and HTTPS protocols and is suitable for a variety of network environments and requirements.

## Features

- **Reverse Proxy**: Capable of forwarding client requests to any HTTP/HTTPS server.
- **Flexible Configuration**: Customize the port, context path, and target proxy URL via command-line arguments.
- **HTTPS Support**: Able to handle HTTPS requests, making it suitable for security-sensitive application scenarios.
- **Static File Saving**: Supports saving accessed static files to a specified local directory.

## Start Commands

The basic command format is as follows:

```shell
go-http-agent --port --context-path --proxy-url
```

### Examples

1. **Reverse Proxy to Baidu**:

```shell
go-http-agent --port 8080 --context-path / --proxy-url http://www.baidu.com
```

Once successfully set, the reverse proxy to Baidu appears as shown in the following image:
![Reverse Proxy Baidu Example](readme_files/1.jpg)

2. **Custom Project Name**:

```shell
go-http-agent --port 8080 --context-path /xxx --proxy-url http://www.baidu.com/yyy
```

With this configuration, you can access the proxy target through a custom context path.

3. **HTTPS Proxy**:

```shell
go-http-agent --port 8080 --context-path / --proxy-url https://www.google.com
```

This configuration allows you to proxy HTTPS requests, such as proxying to Google.
4. ** Websocket Proxy**:

```shell
go-http-agent --port 8090 --context-path /xxx --proxy-url ws://www.baidu.com/yyy
```
## Parameter Explanation

- `--port`: Sets the listening port for the proxy server.
- `--context-path`: Defines the context path of the proxy server.
- `--proxy-url`: Specifies the target URL to which requests will be proxied.
- `--save-dir`: Specifies the path for saving static files (used for saving static resources accessed during browsing).