• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tunnel tcp through NKN client.

NKN Tunnel

GitHub license Go Report Card Build Status PRs Welcome

nkn

Tunnel any TCP applications through NKN client or Tuna. A few advantages:

  • Network agnostic: Neither sender nor receiver needs to have public IP address or port forwarding. NKN tunnel only establish outbound (websocket) connections, so Internet access is all they need on both side.
  • Top level security: All data are end to end authenticated and encrypted. No one else in the world except sender and receiver can see or modify the content of the data. The same public key is used for both routing and encryption, eliminating the possibility of man in the middle attack.
  • Decent performance: By aggregating multiple overlay paths concurrently, one can get ~100ms end to end latency and 10+mbps end to end throughput between international devices using the default NKN client mode, or much lower latency and higher throughput using Tuna mode.
  • Everything is open source and decentralized. The default NKN client mode is free (If you are curious, node relay traffic for clients for free to earn mining rewards in NKN blockchain), while Tuna mode requires listener to pay NKN token directly to Tuna service providers.

A diagram of the default NKN client mode:

                                 A - ... - X
                               /             \
Alice <--> TCP <--> NKN client - B - ... - Y - NKN client <--> TCP <--> Bob
                               \             /
                                 C - ... - Z

A diagram of the Tuna mode:

                                      A
                                    /   \
Alice <--> TCP <--> NKN Tuna client - B - NKN Tuna client <--> TCP <--> Bob
                                    \   /
                                      C

Build

go build -o nkn-tunnel bin/main.go

Basic Usage

"Server" side:

./nkn-tunnel -to 127.0.0.1:8080 -s <seed>

and you will see an output like Listening at xxx where xxx is the server listening address.

"Client" side:

./nkn-tunnel -from 127.0.0.1:8081 -to <server-listening-address>

Now any TCP connection to client port 8081 will be forwarded to server port 8080.

Tuna Mode

Add -tuna on both side of the tunnel to use Tuna mode, which has much better performance but requires listener to pay NKN token directly to Tuna service providers.

Turn on UDP under Tuna Mode

When using Tuna mode, add -udp to turn on UDP communication on both side to support UDP communication.

Contributing

Can I submit a bug, suggestion or feature request?

Yes. Please open an issue for that.

Can I contribute patches?

Yes, we appreciate your help! To make contributions, please fork the repo, push your changes to the forked repo with signed-off commits, and open a pull request here.

Please sign off your commit. This means adding a line "Signed-off-by: Name " at the end of each commit, indicating that you wrote the code and have the right to pass it on as an open source patch. This can be done automatically by adding -s when committing:

git commit -s

Community

More Repositories

1

nkn

Official Go implementation of NKN full node.
Go
472
star
2

nnet

nnet: a fast, scalable, and developer-friendly p2p overlay network stack
Go
118
star
3

nconnect

Securely connect to remote machines without the need of any server, public IP address, or publicly exposed ports.
Go
106
star
4

nkn-sdk-go

Go implementation of NKN client and wallet
Go
58
star
5

nkn-client-js

[Deprecated, use nkn-sdk-js instead] JavaScript implementation of NKN client
JavaScript
55
star
6

nMobile

The world's most secure private and group messenger
Dart
47
star
7

encrypted-stream

A Golang library that transforms any net.Conn or io.ReadWriter stream to an encrypted and/or authenticated stream
Go
46
star
8

nkn-sdk-js

JavaScript Implementation of NKN Client and Wallet SDK
JavaScript
43
star
9

nkn-shell-daemon

NKN shell daemon
JavaScript
30
star
10

tuna

A free market to use service by paying NKN or host service to earn NKN
Go
20
star
11

nkn-simulation

NetLogo
18
star
12

nkn-wallet-js

[Deprecated, use nkn-sdk-js instead] JavaScript implementation of NKN wallet
JavaScript
16
star
13

nkn-java-sdk

JVM sdk for nkn.org, written in Java
Java
13
star
14

nkn-file-transfer

Decentralized file transfer app using NKN client
Go
13
star
15

nkn-sdk-py3

Python3 implementation of NKN SDK
Python
9
star
16

ncp-go

Go implementation of NCP (NKN Control Protocol), a ARQ protocol for NKN network.
Go
9
star
17

nkn-sdk-flutter

Objective-C
9
star
18

nkn-tuna-session

An overlay peer to peer connection based on multiple concurrent tuna connections and ncp protocol.
Go
7
star
19

fortunetree

Front-end for Fortune Tree which is a token incentive forum
JavaScript
6
star
20

nkn-cloud-image

Scripts to automatically build image running NKN node
Makefile
6
star
21

nkn-db-tool

Golang tool to export NKN blockchain database
Go
5
star
22

nkn-multiclient-js

[Deprecated, use nkn-sdk-js instead] A high-level library uses multiple concurrent nkn-client-js
JavaScript
5
star
23

nBounty

NKN bounty program
5
star
24

nftp-js

Source code of of https://nftp.nkn.org
JavaScript
4
star
25

documentations

NKN documentations
HTML
4
star
26

nkn-sdk-cpp

NKN SDK for C/C++
C++
4
star
27

nkn-crawler

nkn-crawler: A python crawler for NKN Network
Python
4
star
28

ncp-js

JavaScript
3
star
29

nshell-chrome-extension

Vue
2
star
30

goproxy

A simple http/https proxy that protects proxy's local/internal network by disallowing local/internal network address as destination.
Go
2
star
31

crypto

Crypto for NKN
Go
2
star
32

eth-resolver-go

Go
2
star
33

nkn-protocols

Documentation and discussion of NKN protocols, including NKN node and NKN client
2
star
34

ip-range-to-cidr

Go
2
star
35

tuna-proxy-speedtest

Test tuna proxy speed using fast.com
Go
2
star
36

mockconn-go

Mocked network connection with customized latency, throughput, loss and buffer size
Go
2
star
37

nkn-node-sampler

NKN node crawler using random sampling
Go
2
star
38

nMobile-legacy

NKN mobile App which include wallet, news, d-chat and IOT devices communication functions
1
star
39

nkn-dashboard

Vue
1
star
40

nkn-utility

Go
1
star
41

portchecker-server

Go
1
star
42

portchecker

Go
1
star
43

nkngomobile

nkngomobile
Go
1
star
44

nkn-shell-client-xterm

A NKN shell client using xterm.js
HTML
1
star
45

portmapper

Go
1
star
46

NKNDataPump

Go
1
star
47

nkn-sdk-android

NKN wallet and data transmission SDK for Android
Kotlin
1
star
48

ncp-go-graph

Go
1
star