]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Merge branch 'dev'
authorMatt Joiner <anacrolix@gmail.com>
Fri, 22 Jun 2018 07:43:51 +0000 (17:43 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 22 Jun 2018 07:43:51 +0000 (17:43 +1000)
bencode/decode.go
portfwd.go

index 798ad15e9c8176d038fb23fdbddc87292d4c6e76..657cebb0a08fa0c5039aa15558fc7c616a4d823b 100644 (file)
@@ -227,9 +227,9 @@ func getDictField(dict reflect.Value, key string) dictField {
                        })
                }
                return dictField{
-                       Value:                    dict.FieldByIndex(sf.Index),
-                       Ok:                       true,
-                       Set:                      func() {},
+                       Value: dict.FieldByIndex(sf.Index),
+                       Ok:    true,
+                       Set:   func() {},
                        IgnoreUnmarshalTypeError: getTag(sf.Tag).IgnoreUnmarshalTypeError(),
                }
        default:
index c92296301c33fd0de06e80147cd3c9cdbace68c1..301308f6e21c8535915fab21b47e2b2650fde3a4 100644 (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()
 }