Fix go-libutp import when CGO is disabled
This commit is contained in:
parent
2b0ec5d762
commit
48fa9b59fd
|
@ -5,7 +5,6 @@ import (
|
|||
"net"
|
||||
"strconv"
|
||||
|
||||
utp "github.com/anacrolix/go-libutp"
|
||||
"github.com/anacrolix/missinggo/perf"
|
||||
"github.com/anacrolix/missinggo/v2"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -101,7 +100,8 @@ func listenAllRetry(nahs []networkAndHost, port int, f firewallCallback) (ss []s
|
|||
return
|
||||
}
|
||||
|
||||
type firewallCallback = utp.FirewallCallback
|
||||
// This isn't aliased from go-libutp since that assumes CGO.
|
||||
type firewallCallback func(net.Addr) bool
|
||||
|
||||
func listenUtp(network, addr string, fc firewallCallback) (socket, error) {
|
||||
us, err := NewUtpSocket(network, addr, fc)
|
||||
|
|
|
@ -16,7 +16,7 @@ func NewUtpSocket(network, addr string, fc firewallCallback) (utpSocket, error)
|
|||
return s, err
|
||||
}
|
||||
if fc != nil {
|
||||
s.SetSyncFirewallCallback(fc)
|
||||
s.SetSyncFirewallCallback(utp.FirewallCallback(fc))
|
||||
}
|
||||
return s, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue