github.com/cawidtu/notwireguard-go/device@v0.0.0-20230523131112-68e8e5ce9cdf/mobilequirks.go (about)

     1  /* SPDX-License-Identifier: MIT
     2   *
     3   * Copyright (C) 2017-2021 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.Lock()
    15  		peer.disableRoaming = peer.endpoint != nil
    16  		peer.Unlock()
    17  	}
    18  	device.peers.RUnlock()
    19  }