New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/alongl/tcprelay

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/alongl/tcprelay

  • v0.0.0-20231110094457-1fa4f20e6775
  • Source
  • Go
  • Socket score

Version published
Created
Source

tcprelay

tcprelay helps client accessing the host unreachable. For example:

  • Virtual machine vm1 runing on server A, with NAT ip 192.168.122.*.
  • Server A has public IP 192.168.1.10.
  • Client can access server A, but can not access tcp port 80 of vm1 directly.
  • With tcprelay running on server A.
  • Client can access tcp port 80 of vm1 directly by 192.168.1.10:8080.

Figure

Client A can not direct access target machine, for some reason firewall or NAT etc.
The other middle machine can access target. Tcp client can access target with tcp by tcprelay running on middle machine.

                                             +----------------+
                                             |                |
        +------------------------------->    |     target     |(vm1)
        |     can not direct access          |                |
        |                                    +----------------+
        |                                             ^  192.168.122.*:80
        |                                             |
        |                                             | 
        |                                             |  192.168.122.1
+--------------+                             +----------------+
|              | 192.168.1.20                |                |
|   client A   | +------------------------>  |     server A   |(tcprelay)
|              |           192.168.1.10:8080 |                |
+--------------+                             +----------------+

how to run

on server A, run tcprelay.

./tcprelay -l ":8080"  -t "192.168.122.101:80"

It will listen on 8080, and all the client connected to :8080 will be relay to 192.168.1.101:80

For the client, just type http://1.2.3.4:8080 you can access the web service on target machine.

how to build

download this code, cd into the dir. type command as follows:

SET GOOS=linux
SET GOARCH=amd64
SET GOPROXY=https://goproxy.cn
go build .

download

if you don't want to compile it. just download in release page.
It's very easy to use.

reference

This program is taken from this two repository. they are the hero.

https://github.com/xtaci/kcptun
https://github.com/hikaricai/p2p_tun

powerful another port mapping tool

gost is a powerful relay tool.
https://github.com/ginuerzh/gost
It's easy to use, like this.

./gost -L  tcp://:8080/192.168.122.101:80  

FAQs

Package last updated on 10 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc