moving upnp to a separate repository

This commit is contained in:
Denis Kuzmenok 2018-06-19 15:49:20 +03:00 committed by Matt Joiner
parent 0ea4383efc
commit 62637ce52d
1 changed files with 5 additions and 5 deletions

View File

@ -5,11 +5,11 @@ import (
"time"
flog "github.com/anacrolix/log"
"github.com/syncthing/syncthing/lib/nat"
"github.com/syncthing/syncthing/lib/upnp"
"github.com/elgatito/upnp"
)
func addPortMapping(d nat.Device, proto nat.Protocol, internalPort int, debug bool) {
func addPortMapping(d upnp.Device, proto upnp.Protocol, internalPort int, debug bool) {
externalPort, err := d.AddPortMapping(proto, internalPort, internalPort, "anacrolix/torrent", 0)
if err != nil {
log.Printf("error adding %s port mapping: %s", proto, err)
@ -33,8 +33,8 @@ func (cl *Client) forwardPort() {
port := cl.incomingPeerPort()
cl.mu.Unlock()
for _, d := range ds {
go addPortMapping(d, nat.TCP, port, cl.config.Debug)
go addPortMapping(d, nat.UDP, port, cl.config.Debug)
go addPortMapping(d, upnp.TCP, port, cl.config.Debug)
go addPortMapping(d, upnp.UDP, port, cl.config.Debug)
}
cl.mu.Lock()
}