Giter Site home page Giter Site logo

icodein / mr2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from txthinking/zoro

0.0 2.0 0.0 680 KB

mr2 can help you expose local server to external network. Support both TCP/UDP, of course support HTTP. Zero-Configuration. mr2 帮助你将本地端口暴露在外网.支持TCP/UDP, 当然也支持HTTP.

License: GNU General Public License v3.0

Go 97.34% Shell 2.66%

mr2's Introduction

mr2

中文

Build Status License: GPL v3 Donate Slack

mr2 can help you expose local server to external network. Support both TCP/UDP, of course support HTTP. Keep it simple, stupid.

❤️ A project by txthinking.com

Install via nami

$ nami install github.com/txthinking/mr2

Install via brew (macOS only)

$ brew install mr2

Usage

NAME:
   mr2 - Expose local TCP and UDP server to external network

USAGE:
   mr2 [global options] command [command options] [arguments...]

VERSION:
   20210401

COMMANDS:
   server       Run as server mode
   client       Run as client mode
   httpsserver  Run as https server mode
   httpsclient  Run as https client mode
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

server and client

On remote server. Note that the firewall opens TCP and UDP on all relevant ports

$ mr2 server -l :9999 -p password

More parameters: $ mr2 server -h

On local. Assume your remote mr2 server is 1.2.3.4:9999, your local server is 127.0.0.1:8080, want the remote server to open port 8888

$ mr2 client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:8080

More parameters: $ mr2 client -h

Then access 1.2.3.4:8888 equals to access 127.0.0.1:8080

Example of server and client

Expose local HTTP server

$ mr2 client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:8080

Then access 1.2.3.4:8888 equals to access 127.0.0.1:8080

Expose local SSH

$ mr2 client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:22

Then access 1.2.3.4:8888 equals to access 127.0.0.1:22

$ ssh -oPort=8888 [email protected]

Expose local DNS server

$ mr2 client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:53

Then access 1.2.3.4:8888 equals to access 127.0.0.1:53

$ dig github.com @1.2.3.4 -p 8888

Expose local directory via HTTP

$ mr2 client -s 1.2.3.4:9999 -p password --serverPort 8888 --clientDirectory /path/to/www --clientPort 8080

Then access 1.2.3.4:8888 equals to access 127.0.0.1:8080, web root is /path/to/www

Expose local brook server

$ brook server -l :8080 -p password # or wsserver
$ mr2 client -s 1.2.3.4:9999 -p password --serverPort 8888 -c 127.0.0.1:8080

Then access 1.2.3.4:8888 equals to access 127.0.0.1:8080, used to create a brook server or wsserver in a server even if there is no public IP

Expose any TCP/UDP service

...

httpsserver and httpsclient

On remote server. Assume your domain is domain.com, cert of *.domain.com is ./domain_com_cert.pem and ./domain_com_cert_key.pem, want https listen on 443. Note that the firewall opens TCP on all relevant ports

$ mr2 httpsserver -l :9999 -p password --domain domain.com --cert ./domain_com_cert.pem --certKey ./domain_com_cert_key.pem --tlsPort 443

More parameters: $ mr2 httpsserver -h

On local. Assume your remote mr2 httpsserver is 1.2.3.4:9999, your local HTTP 1.1 server is 127.0.0.1:8080, want the remote server to open subdomain hey

$ mr2 httpsclient -s 1.2.3.4:9999 -p password --serverSubdomain hey -c 127.0.0.1:8080

More parameters: $ mr2 httpsclient -h

Then access https://hey.domain.com:443 equals to access http://127.0.0.1:8080

About UDP

In some cases of multi-layer NAT, UDP may fail. I passed the test when I connected directly to the Wi-Fi provided by the ISP.

License

Licensed under The GPLv3 License

mr2's People

Contributors

txthinking avatar 0xflotus avatar monkeywithacupcake avatar honwen avatar rpomykala avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.