]> Sergey Matveev's repositories - btrtrc.git/blob - utp_libutp.go
Explicitly use go-libutp synchronous firewall callback
[btrtrc.git] / utp_libutp.go
1 //go:build cgo && !disable_libutp
2 // +build cgo,!disable_libutp
3
4 package torrent
5
6 import (
7         utp "github.com/anacrolix/go-libutp"
8 )
9
10 func NewUtpSocket(network, addr string, fc firewallCallback) (utpSocket, error) {
11         s, err := utp.NewSocket(network, addr)
12         if s == nil {
13                 return nil, err
14         }
15         if err != nil {
16                 return s, err
17         }
18         if fc != nil {
19                 s.SetSyncFirewallCallback(fc)
20         }
21         return s, err
22 }