bridge

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2019 License: MIT Imports: 3 Imported by: 1

README

Bridge

Bridge is a TCP proxy tool Support http(s)-connect socks4/4a/5/5h ssh

Build Status Go Report Card GoDoc Docker Automated build GitHub license

Example

Mapping github.io: 80 TCP port to 8080 port of the local machine
access using IP will return 404 pages.

bridge -b :8080 -p github.io:80

Proxy that can go through various protocols

bridge -b :8080 -p github.io:80 -p ssh://username:password@my_server:22
bridge -b :8080 -p github.io:80 -p ssh://username@my_server:22?identity_file=~/.ssh/id_rsa
bridge -b :8080 -p github.io:80 -p socks5://username:password@my_server:1080
bridge -b :8080 -p github.io:80 -p http://username:password@my_server:8080

It can also go through multi-level proxy

bridge -b :8080 -p github.io:80 -p http://username:password@my_server2:8080 -p http://username:password@my_server1:8080

You can also use ssh to listen for port mapping from local port to server port,
due to the limitation of sshd, only 127.0.0.1 ports can be monitored.
if you want to provide external services,
you need to change the gatewayports no in /etc/ssh/ sshd_config to yes
and then reload sshd.

bridge -b :8080 -b ssh://username:password@my_server:22 -p 127.0.0.1:80

More of the time I'm acting as an ssh proxy
in ~/.ssh/config

ProxyCommand bridge -p %h:%p -p "ssh://username@my_server?identity_file=~/.ssh/id_rsa"

Usage

        bridge [-d] \
        [-b=[bind_address]:bind_port \
        [-b=ssh://bridge_bind_address:bridge_bind_port [-b=(socks5|socks4|socks4a|https|http|ssh)://bridge_bind_address:bridge_bind_port ...]]] \ //
        -p=proxy_address:proxy_port \
        [-p=(socks4|socks4a|socks5|socks5h|https|http|ssh)://bridge_proxy_address:bridge_proxy_port ...]
  -b, --bind strings    The first is the listening address, and then the proxy through which the listening address passes.
                        If it is not filled in, it is redirected to the pipeline.
                        only SSH and local support listening, so the last proxy must be ssh.
  -d, --debug           Output the communication data.
  -p, --proxy strings   The first is the dial-up address, followed by the proxy through which the dial-up address passes.

Install

go get -u -v github.com/wzshiming/bridge/cmd/bridge

or

Docker image

License

Pouch is licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeFunc

type BridgeFunc func(dialer Dialer, addr string) (Dialer, ListenConfig, error)

func (BridgeFunc) Bridge

func (b BridgeFunc) Bridge(dialer Dialer, addr string) (Dialer, ListenConfig, error)

type Bridger

type Bridger interface {
	Bridge(dialer Dialer, addr string) (Dialer, ListenConfig, error)
}

type DialFunc

type DialFunc func(ctx context.Context, network, addr string) (c net.Conn, err error)

func (DialFunc) DialContext

func (b DialFunc) DialContext(ctx context.Context, network, addr string) (c net.Conn, err error)

type Dialer

type Dialer interface {
	proxy.ContextDialer
}

type ListenConfig

type ListenConfig interface {
	Listen(ctx context.Context, network, addr string) (net.Listener, error)
}

type ListenConfigFunc

type ListenConfigFunc func(ctx context.Context, network, addr string) (net.Listener, error)

func (ListenConfigFunc) Listen

func (b ListenConfigFunc) Listen(ctx context.Context, network, addr string) (net.Listener, error)

Directories

Path Synopsis
cmd
bridge command

Jump to

Keyboard shortcuts

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