YTSFlix_Go/vendor/github.com/anacrolix/torrent/utp_libutp.go

22 lines
374 B
Go
Raw Normal View History

2018-11-04 14:58:15 +00:00
// +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
}