github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/docs/v2/framework/tunnel.md (about) 1 --- 2 title: Service Tunnel 3 keywords: tunnel 4 tags: [tunnel] 5 sidebar: home_sidebar 6 permalink: /tunnel 7 summary: The micro tunnel is a point to point tunnel. 8 --- 9 10 A service tunnel is a point to point tunnel used for accessing services in remote environments. 11 12 <img src="images/tunnel.svg" /> 13 14 ## Overview 15 16 The micro tunnel provides a way to access services across remote environments. This is great where you want to tunnel to staging, prod 17 or expose local services externally without using something like openvpn or wireguard which would expose all things in your network. 18 19 ## Run Tunnel 20 21 Start the tunnel server (Runs on port :8083) 22 23 ```shell 24 micro tunnel 25 ``` 26 27 ## Tunnel Services 28 29 Now the tunnel is running you can connect to it with a local tunnel. 30 31 ``` 32 micro tunnel --server=remote.env:8083 33 ``` 34 35 Any request now made through the tunnel will be proxied to a service on the other side. 36 37 Set your proxy to use the tunnel 38 ``` 39 MICRO_PROXY=go.micro.tunnel go run main.go 40 ``` 41 42 Your service will direct all traffic through the tunnel. 43 44 45 ## Authentication 46 47 Specify a tunnel token to limit access to who can tunnel into the environment. Tokens must match between 48 tunnel clients and servers otherwise the connection is rejected. 49 50 ``` 51 MICRO_TUNNEL_TOKEN=foobar go run main.go 52 ``` 53 54 By default the token "micro" is used allowing anyone to connect via the tunnel. 55