MCPcopy Create free account
hub / github.com/PasarGuard/node / SyncUser

Method SyncUser

backend/wireguard/user.go:12–21  ·  view source on GitHub ↗

SyncUser synchronizes a single user to the WireGuard interface. Each user has a single key/IP pair (/32 for IPv4, /128 for IPv6).

(_ context.Context, user *common.User)

Source from the content-addressed store, hash-verified

10// SyncUser synchronizes a single user to the WireGuard interface.
11// Each user has a single key/IP pair (/32 for IPv4, /128 for IPv6).
12func (wg *WireGuard) SyncUser(_ context.Context, user *common.User) error {
13 if user == nil {
14 return fmt.Errorf("user is nil")
15 }
16
17 wg.syncMu.Lock()
18 defer wg.syncMu.Unlock()
19
20 return wg.syncUsersPartialReconcile([]*common.User{user})
21}
22
23// SyncUsers synchronizes multiple users to the WireGuard interface.
24func (wg *WireGuard) SyncUsers(_ context.Context, users []*common.User) error {

Calls 1