goproxy

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 10 Imported by: 0

README

GoDoc

goproxy

A Go-based reverse proxy and AWS PrivateLink replacement running as a systemd service on EC2 instances. Includes rate limiting, bot blocking, and dynamic routing based on subdomains and paths.

Features

  • Reverse proxy for handling incoming requests
  • Rate limiting to prevent abuse
  • Bot blocking based on user-agent strings
  • Dynamic routing based on subdomains and paths
  • Configurable via a YAML configuration file

Installation

  1. Clone the repository:

    git clone https://github.com/dutchdata/goproxy.git
    cd goproxy
    
  2. Build the binary:

    go build -o goproxy
    
  3. Create a configuration file:

    cp config.yaml.example config.yaml
    
  4. Run the service:

    ./goproxy -config config.yaml
    
  5. Set up as a systemd service (example: /etc/systemd/system/goproxy.service):

    [Unit]
    Description=Go Proxy Service
    
    [Service]
    ExecStart=/home/ec2-user/goproxy/goproxy -config /home/ec2-user/goproxy/config.yaml
    Restart=always
    User=ec2-user
    Group=ec2-user
    WorkingDirectory=/home/ec2-user/goproxy/
    
    [Install]
    WantedBy=multi-user.target
    
    sudo systemctl daemon-reload
    sudo systemctl enable goproxy
    sudo systemctl start goproxy
    

    And to check logs:

    journalctl -u goproxy.service -f
    

Configuration

The configuration file supports the following fields:

  • port: The port on which the proxy server listens.
  • limiter: Rate limiting configuration, with rps (requests per second) and burst values.
  • botBlockList: A list of user-agent substrings to block.
  • permittedBots: A list of user-agent substrings to allow.
  • otherRoutes: A list of routes for subdomains and paths.
    • ip: Target IP address.
    • port: Target port.
    • path: Path or subdomain for routing.
  • defaultRoute: Default route configuration.
    • ip: Default target IP address.
    • port: Default target port.

Contributing

Feel free to open issues or submit pull requests. Contributions are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL