koding/tunnel

Example of new api

Closed this issue · 3 comments

Hi guys,

first, thanks for this project - it solves a very practical problem for me: exposing an Android app (Wireless mic) so I can "listen" to my house from work!
(Using a computer at home - but could be a RPI in the future...)

So, my " setup" works with the exact example, and a single new config line:

	cfg := &tunnel.ClientConfig{
		Identifier: "1234",
		ServerAddr: "hugows.com:9999",
		LocalAddr:  "192.168.0.21:8081",
	}

Since you say in the docs that:

// LocalAddr is DEPRECATED please use ProxyHTTP.LocalAddr, see ProxyOverwrite for more details.
LocalAddr string

Could you provide an example of how to achieve the same thing with Proxy (I couldn't find the exact symbols) since it seems to be the proper way now.

Hi @hugows,
the old API still works just fine, you can find example of new API here https://github.com/koding/tunnel/blob/master/tunneltest/tunneltest.go#L276

In your case it should be like

httpProxy := &tunnel.HTTPProxy{LocalAddr: "192.168.0.21:8081"}
cfg := &tunnel.ClientConfig{
	Identifier: "1234",
	ServerAddr: "hugows.com:9999",
	Proxy:  httpProxy.Proxy,
}

@hugows note the update

Thanks @mmatczuk!
You last edit worked perfectly!