gohpts

package module
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 12 Imported by: 0

README

GoHPTS - HTTP proxy to SOCKS5 proxy written in Go

Go Reference GitHub go.mod Go version Go Report Card GitHub Release GitHub Downloads (all assets, all releases)

Introduction

GoHPTS CLI tool is a bridge between HTTP clients and a SOCKS5 proxy server. It listens locally as an HTTP proxy, accepts standard HTTP or HTTPS (via CONNECT) requests and forwards the connection through a SOCKS5 proxy. Inspired by http-proxy-to-socks

Possible use case: you need to connect to external API via Postman, but this API only available from some remote server. The following commands will help you to perform such a task:

Create SOCKS5 proxy server via ssh:

ssh <remote server> -D 1080 -Nf

Create HTTP-to-SOCKS5 connection with gohpts

gohpts -s :1080 -l :8080

Specify http server in proxy configuration of Postman

Installation

You can download the binary for your platform from Releases page.

Alternatively, you can install it using go install command (requires Go 1.24 or later):

go install -ldflags "-s -w" -trimpath github.com/shadowy-pycoder/go-http-proxy-to-socks/cmd/gohpts@latest

This will install the gohpts binary to your $GOPATH/bin directory.

Another alternative is to build from source:

git clone https://github.com/shadowy-pycoder/go-http-proxy-to-socks.git
cd go-http-proxy-to-socks
make build
./bin/gohpts

Usage

gohpts -h

    _____       _    _ _____ _______ _____
  / ____|     | |  | |  __ \__   __/ ____|
 | |  __  ___ | |__| | |__) | | | | (___
 | | |_ |/ _ \|  __  |  ___/  | |  \___ \
 | |__| | (_) | |  | | |      | |  ____) |
  \_____|\___/|_|  |_|_|      |_| |_____/

GoHPTS (HTTP Proxy to SOCKS5) by shadowy-pycoder
GitHub: https://github.com/shadowy-pycoder/go-http-proxy-to-socks

Usage: gohpts [OPTIONS]
Options:
  -h    Show this help message and exit.
  -d	Show logs in DEBUG mode
  -j	Show logs in JSON format
  -l value
    	Address of HTTP proxy server (Default: localhost:8080)
  -p	Password for SOCKS5 proxy (not echoed to terminal)
  -s value
    	Address of SOCKS5 proxy server (Default: localhost:1080)
  -u string
    	User for SOCKS5 proxy
  -v	print version

Example

gohpts -s 1080 -l 8080 -d -j

Output:

{"level":"info","time":"2025-05-28T06:15:18+00:00","message":"SOCKS5 Proxy: :1080"}
{"level":"info","time":"2025-05-28T06:15:18+00:00","message":"HTTP Proxy: :8080"}
{"level":"debug","time":"2025-05-28T06:15:22+00:00","message":"HTTP/1.1 - CONNECT - www.google.com:443"}

Specify username and password fo SOCKS5 proxy server:

gohpts -s 1080 -l 8080 -d -j -u user -p
SOCKS5 Password: #you will be prompted for password input here

License

MIT

Documentation

Index

Constants

View Source
const Version string = "gohpts v1.3.2"

Variables

This section is empty.

Functions

func New

func New(conf *Config) *proxyApp

Types

type Config

type Config struct {
	AddrHTTP  string
	AddrSOCKS string
	Debug     bool
	Json      bool
	User      string
	Pass      string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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