8 Star 22 Fork 6

wzshiming / bridge

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Bridge

Bridge 是一个支持 http(s)-connect socks4/4a/5/5h ssh proxycommand 的tcp代理工具

Build Go Report Card GoDoc Docker Automated build GitHub license

支持的协议

示例

映射 example.org:80 tcp 端口到本机的 8080 端口.

bridge -b :8080 -p example.org:80
# `curl -H 'Host: example.org' 127.0.0.1:8080` 将返回目标的页面

可以经过各种协议的代理.

bridge -b :8080 -p example.org:80 -p ssh://username:password@my_server:22
bridge -b :8080 -p example.org:80 -p ssh://username@my_server:22?identity_file=~/.ssh/id_rsa
bridge -b :8080 -p example.org:80 -p socks5://username:password@my_server:1080
bridge -b :8080 -p example.org:80 -p http://username:password@my_server:8080
bridge -b :8080 -p example.org:80 -p 'cmd:nc %h %p'
bridge -b :8080 -p example.org:80 -p 'cmd:ssh sshserver nc %h %p'

也可以经过多级代理

bridge -b :8080 -p example.org:80 -p http://username:password@my_server2:8080 -p http://username:password@my_server1:8080

使用代理协议(http/socks4/socks5)代替直接TCP转发.

bridge -b :8080 -p -
bridge -b :8080 -p - -p http://username:password@my_server1:8080
# `http_proxy=http://127.0.0.1:8080 curl example.org` 将经过代理

也可以通过 ssh 监听端口 本地的端口映射到服务器的端口,
由于 sshd 的限制只能监听 127.0.0.1 的端口,
如果想提供对外的服务需要把 /etc/ssh/sshd_config 里的 GatewayPorts no 改成 yes 然后重新加载 sshd.

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

更多的时候我是用作 ssh 代理的.

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

用法

Usage: bridge [-d] \
	[-b=[[tcp://]bind_address]:bind_port \
	[-b=ssh://bridge_bind_address:bridge_bind_port [-b=(socks4://|socks4a://|socks5://|socks5h://|https://|http://|ssh://|cmd:)bridge_bind_address:bridge_bind_port ...]]] \ // 
	-p=([tcp://]proxy_address:proxy_port|-) \
	[-p=(socks4://|socks4a://|socks5://|socks5h://|https://|http://|ssh://|cmd:)bridge_proxy_address:bridge_proxy_port ...]
  -b, --bind strings    第一个是侦听地址,然后是侦听地址通过的代理。
                        如果未填写,则重定向到管道。
                        只有ssh和本地支持监听,所以最后一个代理必须是ssh。
  -d, --debug           输出通信数据。
  -p, --proxy strings   第一个是拨号地址,然后是拨号地址通过的代理。

安装

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

or

Download releases

or

Docker image

许可证

软包根据MIT License。有关完整的许可证文本,请参阅LICENSE

MIT License Copyright (c) 2019 wzshiming Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Bridge 是一个支持 http(s)-connect socks4/4a/5/5h ssh proxycommand 的tcp代理工具 展开 收起
Go 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/wzshiming/bridge.git
git@gitee.com:wzshiming/bridge.git
wzshiming
bridge
bridge
master

搜索帮助