koding / tunnel

Tunnel proxy package in Go
BSD 3-Clause "New" or "Revised" License
314 stars 70 forks source link

Example of new api #40

Closed hugows closed 7 years ago

hugows commented 7 years ago

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.

mmatczuk commented 7 years ago

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,
}
mmatczuk commented 7 years ago

@hugows note the update

hugows commented 7 years ago

Thanks @mmatczuk! You last edit worked perfectly!