* Update anacrolix/go-libutp (v1.1.0 -> v1.2.0) * Pass client logger to anacrolix/go-libutp * Pass logger instead of option The project now compiles properly when CGO is not enabled. Additionally, the new argument (now log.Logger instead of utp.NewSocketOpt) is now required. The tests have been updated to match this change, and now pass logger.Default to NewUtpSocket. * Correct function signature of NewUtpSocket
24 lines
487 B
Go
24 lines
487 B
Go
//go:build cgo && !disable_libutp
|
|
// +build cgo,!disable_libutp
|
|
|
|
package torrent
|
|
|
|
import (
|
|
utp "github.com/anacrolix/go-libutp"
|
|
"github.com/anacrolix/log"
|
|
)
|
|
|
|
func NewUtpSocket(network, addr string, fc firewallCallback, logger log.Logger) (utpSocket, error) {
|
|
s, err := utp.NewSocket(network, addr, utp.WithLogger(logger))
|
|
if s == nil {
|
|
return nil, err
|
|
}
|
|
if err != nil {
|
|
return s, err
|
|
}
|
|
if fc != nil {
|
|
s.SetSyncFirewallCallback(utp.FirewallCallback(fc))
|
|
}
|
|
return s, err
|
|
}
|