2
0
mirror of synced 2025-02-24 14:48:27 +00:00
torrent/utp_libutp.go
afjoseph 013634d9f1 Revert "Remove old-style build tags"
This reverts commit 11ae25660ad3048ee5736694793fead3305f5c5b.
2021-11-01 11:26:58 +11:00

23 lines
408 B
Go

//go:build cgo && !disable_libutp
// +build cgo,!disable_libutp
package torrent
import (
"github.com/anacrolix/go-libutp"
)
func NewUtpSocket(network, addr string, fc firewallCallback) (utpSocket, error) {
s, err := utp.NewSocket(network, addr)
if s == nil {
return nil, err
}
if err != nil {
return s, err
}
if fc != nil {
s.SetFirewallCallback(utp.FirewallCallback(fc))
}
return s, err
}