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)
| 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). |
| 12 | func (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. |
| 24 | func (wg *WireGuard) SyncUsers(_ context.Context, users []*common.User) error { |