github.com/amnezia-vpn/amnezia-wg@v0.1.8/device/mobilequirks.go (about)

     1  /* SPDX-License-Identifier: MIT
     2   *
     3   * Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved.
     4   */
     5  
     6  package device
     7  
     8  // DisableSomeRoamingForBrokenMobileSemantics should ideally be called before peers are created,
     9  // though it will try to deal with it, and race maybe, if called after.
    10  func (device *Device) DisableSomeRoamingForBrokenMobileSemantics() {
    11  	device.net.brokenRoaming = true
    12  	device.peers.RLock()
    13  	for _, peer := range device.peers.keyMap {
    14  		peer.endpoint.Lock()
    15  		peer.endpoint.disableRoaming = peer.endpoint.val != nil
    16  		peer.endpoint.Unlock()
    17  	}
    18  	device.peers.RUnlock()
    19  }