github.com/tailscale/wireguard-go@v0.0.20201119-0.20210522003738-46b531feb08a/device/constants.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  import (
     9  	"time"
    10  )
    11  
    12  /* Specification constants */
    13  
    14  const (
    15  	RekeyAfterMessages      = (1 << 60)
    16  	RejectAfterMessages     = (1 << 64) - (1 << 13) - 1
    17  	RekeyAfterTime          = time.Second * 120
    18  	RekeyAttemptTime        = time.Second * 90
    19  	RekeyTimeout            = time.Second * 5
    20  	MaxTimerHandshakes      = 90 / 5 /* RekeyAttemptTime / RekeyTimeout */
    21  	RekeyTimeoutJitterMaxMs = 334
    22  	RejectAfterTime         = time.Second * 180
    23  	KeepaliveTimeout        = time.Second * 10
    24  	CookieRefreshTime       = time.Second * 120
    25  	HandshakeInitationRate  = time.Second / 50
    26  	PaddingMultiple         = 16
    27  )
    28  
    29  const (
    30  	MinMessageSize = MessageKeepaliveSize                  // minimum size of transport message (keepalive)
    31  	MaxMessageSize = MaxSegmentSize                        // maximum size of transport message
    32  	MaxContentSize = MaxSegmentSize - MessageTransportSize // maximum size of transport message content
    33  )
    34  
    35  /* Implementation constants */
    36  
    37  const (
    38  	UnderLoadAfterTime = time.Second // how long does the device remain under load after detected
    39  	MaxPeers           = 1 << 16     // maximum number of configured peers
    40  )