mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-10-21 15:49:37 +08:00
conn: introduce new package that splits out the Bind and Endpoint types
The sticky socket code stays in the device package for now, as it reaches deeply into the peer list. This is the first step in an effort to split some code out of the very busy device package. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:

committed by
Jason A. Donenfeld

parent
6aefb61355
commit
203554620d
@@ -12,6 +12,8 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"golang.zx2c4.com/wireguard/conn"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -24,7 +26,7 @@ type Peer struct {
|
||||
keypairs Keypairs
|
||||
handshake Handshake
|
||||
device *Device
|
||||
endpoint Endpoint
|
||||
endpoint conn.Endpoint
|
||||
persistentKeepaliveInterval uint16
|
||||
|
||||
// These fields are accessed with atomic operations, which must be
|
||||
@@ -290,7 +292,7 @@ func (peer *Peer) Stop() {
|
||||
|
||||
var RoamingDisabled bool
|
||||
|
||||
func (peer *Peer) SetEndpointFromPacket(endpoint Endpoint) {
|
||||
func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) {
|
||||
if RoamingDisabled {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user