mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-02 03:19:34 +01:00
Move receiverCreator to new file
This commit is contained in:
parent
b355c34b63
commit
28a9a2ef87
@ -13,14 +13,6 @@ import (
|
|||||||
wgConn "golang.zx2c4.com/wireguard/conn"
|
wgConn "golang.zx2c4.com/wireguard/conn"
|
||||||
)
|
)
|
||||||
|
|
||||||
type receiverCreator struct {
|
|
||||||
iceBind *ICEBind
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rc receiverCreator) CreateIPv4ReceiverFn(msgPool *sync.Pool, pc *ipv4.PacketConn, conn *net.UDPConn) wgConn.ReceiveFunc {
|
|
||||||
return rc.iceBind.createIPv4ReceiverFn(msgPool, pc, conn)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ICEBind struct {
|
type ICEBind struct {
|
||||||
*wgConn.StdNetBind
|
*wgConn.StdNetBind
|
||||||
|
|
||||||
@ -35,9 +27,8 @@ func NewICEBind(transportNet transport.Net) *ICEBind {
|
|||||||
transportNet: transportNet,
|
transportNet: transportNet,
|
||||||
}
|
}
|
||||||
|
|
||||||
rc := receiverCreator{
|
rc := newReceiverCreator(ib)
|
||||||
ib,
|
|
||||||
}
|
|
||||||
ib.StdNetBind = wgConn.NewStdNetBindWithReceiverCreator(rc)
|
ib.StdNetBind = wgConn.NewStdNetBindWithReceiverCreator(rc)
|
||||||
return ib
|
return ib
|
||||||
}
|
}
|
||||||
|
23
iface/bind/receiver_creator.go
Normal file
23
iface/bind/receiver_creator.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package bind
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"golang.org/x/net/ipv4"
|
||||||
|
wgConn "golang.zx2c4.com/wireguard/conn"
|
||||||
|
)
|
||||||
|
|
||||||
|
type receiverCreator struct {
|
||||||
|
iceBind *ICEBind
|
||||||
|
}
|
||||||
|
|
||||||
|
func newReceiverCreator(iceBind *ICEBind) receiverCreator {
|
||||||
|
return receiverCreator{
|
||||||
|
iceBind: iceBind,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rc receiverCreator) CreateIPv4ReceiverFn(msgPool *sync.Pool, pc *ipv4.PacketConn, conn *net.UDPConn) wgConn.ReceiveFunc {
|
||||||
|
return rc.iceBind.createIPv4ReceiverFn(msgPool, pc, conn)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user