mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 03:40:28 +00:00
Fix typos
This commit is contained in:
parent
9967541627
commit
73f50af3b7
@ -66,7 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- On recent Linux kernels, Yggdrasil will now set the `tcp_congestion_control` algorithm used for its own TCP sockets to [BBR](https://github.com/google/bbr), which reduces latency under load
|
- On recent Linux kernels, Yggdrasil will now set the `tcp_congestion_control` algorithm used for its own TCP sockets to [BBR](https://github.com/google/bbr), which reduces latency under load
|
||||||
- The systemd service configuration in `contrib` (and, by extension, some of our packages) now attemps to load the `tun` module, in case TUN/TAP support is available but not loaded, and it restricts Yggdrasil to the `CAP_NET_ADMIN` capability for managing the TUN/TAP adapter, rather than letting it do whatever the (typically `root`) user can do
|
- The systemd service configuration in `contrib` (and, by extension, some of our packages) now attempts to load the `tun` module, in case TUN/TAP support is available but not loaded, and it restricts Yggdrasil to the `CAP_NET_ADMIN` capability for managing the TUN/TAP adapter, rather than letting it do whatever the (typically `root`) user can do
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- The `yggdrasil.Conn.RemoteAddr()` function no longer blocks, fixing a deadlock when CKR is used while under heavy load
|
- The `yggdrasil.Conn.RemoteAddr()` function no longer blocks, fixing a deadlock when CKR is used while under heavy load
|
||||||
@ -90,7 +90,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- Some minor memory leaks in the switch have been fixed, which improves memory usage on mobile builds
|
- Some minor memory leaks in the switch have been fixed, which improves memory usage on mobile builds
|
||||||
- A memory leak in the add-peer loop has been fixed
|
- A memory leak in the add-peer loop has been fixed
|
||||||
- The admin socket now reports the correct URI strings for SOCKS peers in `getPeers`
|
- The admin socket now reports the correct URI strings for SOCKS peers in `getPeers`
|
||||||
- A race condition when dialling a remote node by both the node address and routed prefix simultaneously has been fixed
|
- A race condition when dialing a remote node by both the node address and routed prefix simultaneously has been fixed
|
||||||
- A race condition between the router and the dial code resulting in a panic has been fixed
|
- A race condition between the router and the dial code resulting in a panic has been fixed
|
||||||
- A panic which could occur when the TUN/TAP interface disappears (e.g. during soft-shutdown) has been fixed
|
- A panic which could occur when the TUN/TAP interface disappears (e.g. during soft-shutdown) has been fixed
|
||||||
- A bug in the semantic versioning script which accompanies Yggdrasil for builds has been fixed
|
- A bug in the semantic versioning script which accompanies Yggdrasil for builds has been fixed
|
||||||
@ -180,7 +180,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
## [0.3.4] - 2019-03-12
|
## [0.3.4] - 2019-03-12
|
||||||
### Added
|
### Added
|
||||||
- Support for multiple listeners (although currently only TCP listeners are supported)
|
- Support for multiple listeners (although currently only TCP listeners are supported)
|
||||||
- New multicast behaviour where each multicast interface is given it's own link-local listener and does not depend on the `Listen` configuration
|
- New multicast behaviour where each multicast interface is given its own link-local listener and does not depend on the `Listen` configuration
|
||||||
- Blocking detection in the switch to avoid parenting a blocked peer
|
- Blocking detection in the switch to avoid parenting a blocked peer
|
||||||
- Support for adding and removing listeners and multicast interfaces when reloading configuration during runtime
|
- Support for adding and removing listeners and multicast interfaces when reloading configuration during runtime
|
||||||
- Yggdrasil will now attempt to clean up UNIX admin sockets on startup if left behind by a previous crash
|
- Yggdrasil will now attempt to clean up UNIX admin sockets on startup if left behind by a previous crash
|
||||||
@ -374,7 +374,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- Wire format changes (backwards incompatible).
|
- Wire format changes (backwards incompatible).
|
||||||
- Less maintenance traffic per peer.
|
- Less maintenance traffic per peer.
|
||||||
- Exponential back-off for DHT maintenance traffic (less maintenance traffic for known good peers).
|
- Exponential back-off for DHT maintenance traffic (less maintenance traffic for known good peers).
|
||||||
- Iterative DHT (added some time between v0.1.0 and here).
|
- Iterative DHT (added sometime between v0.1.0 and here).
|
||||||
- Use local queue sizes for a sort of local-only backpressure routing, instead of the removed bandwidth estimates, when deciding where to send a packet.
|
- Use local queue sizes for a sort of local-only backpressure routing, instead of the removed bandwidth estimates, when deciding where to send a packet.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
This file generates crypto keys.
|
This file generates crypto keys.
|
||||||
It prints out a new set of keys each time if finds a "better" one.
|
It prints out a new set of keys each time if finds a "better" one.
|
||||||
By default, "better" means a higher NodeID (-> higher IP address).
|
By default, "better" means a higher NodeID (-> higher IP address).
|
||||||
This is because the IP address format can compress leading 1s in the address, to incrase the number of ID bits in the address.
|
This is because the IP address format can compress leading 1s in the address, to increase the number of ID bits in the address.
|
||||||
|
|
||||||
If run with the "-sig" flag, it generates signing keys instead.
|
If run with the "-sig" flag, it generates signing keys instead.
|
||||||
A "better" signing key means one with a higher TreeID.
|
A "better" signing key means one with a higher TreeID.
|
||||||
|
@ -65,12 +65,12 @@ Given the coordinates of any two nodes, it is possible to calculate the length o
|
|||||||
Traffic is forwarded using a [greedy routing](https://en.wikipedia.org/wiki/Small-world_routing#Greedy_routing) scheme, where each node forwards the packet to a one-hop neighbor that is closer to the destination (according to this distance metric) than the current node.
|
Traffic is forwarded using a [greedy routing](https://en.wikipedia.org/wiki/Small-world_routing#Greedy_routing) scheme, where each node forwards the packet to a one-hop neighbor that is closer to the destination (according to this distance metric) than the current node.
|
||||||
In particular, when a packet needs to be forwarded, a node will forward it to whatever peer is closest to the destination in the greedy [metric space](https://en.wikipedia.org/wiki/Metric_space) used by the network, provided that the peer is closer to the destination than the current node.
|
In particular, when a packet needs to be forwarded, a node will forward it to whatever peer is closest to the destination in the greedy [metric space](https://en.wikipedia.org/wiki/Metric_space) used by the network, provided that the peer is closer to the destination than the current node.
|
||||||
|
|
||||||
If no closer peers are idle, then the packet is queued in FIFO order, with separate queues per destination coords (currently, as a bit of a hack, IPv6 flow labels are embedeed after the end of the significant part of the coords, so queues distinguish between different traffic streams with the same destination).
|
If no closer peers are idle, then the packet is queued in FIFO order, with separate queues per destination coords (currently, as a bit of a hack, IPv6 flow labels are embedded after the end of the significant part of the coords, so queues distinguish between different traffic streams with the same destination).
|
||||||
Whenever the node finishes forwarding a packet to a peer, it checks the queues, and will forward the first packet from the queue with the maximum `<age of first packet>/<queue size in bytes>`, i.e. the bandwidth the queue is attempting to use, subject to the constraint that the peer is a valid next hop (i.e. closer to the destination than the current node).
|
Whenever the node finishes forwarding a packet to a peer, it checks the queues, and will forward the first packet from the queue with the maximum `<age of first packet>/<queue size in bytes>`, i.e. the bandwidth the queue is attempting to use, subject to the constraint that the peer is a valid next hop (i.e. closer to the destination than the current node).
|
||||||
If no non-empty queue is available, then the peer is added to the idle set, forward packets when the need arises.
|
If no non-empty queue is available, then the peer is added to the idle set, forward packets when the need arises.
|
||||||
|
|
||||||
This acts as a crude approximation of backpressure routing, where the remote queue sizes are assumed to be equal to the distance of a node from a destination (rather than communicating queue size information), and packets are never forwarded "backwards" through the network, but congestion on a local link is routed around when possible.
|
This acts as a crude approximation of backpressure routing, where the remote queue sizes are assumed to be equal to the distance of a node from a destination (rather than communicating queue size information), and packets are never forwarded "backwards" through the network, but congestion on a local link is routed around when possible.
|
||||||
The queue selection strategy behaves similar to shortest-queue-first, in that a larger fration of available bandwith to sessions that attempt to use less bandwidth, and is loosely based on the rationale behind some proposed solutions to the [cake-cutting](https://en.wikipedia.org/wiki/Fair_cake-cutting) problem.
|
The queue selection strategy behaves similar to shortest-queue-first, in that a larger fraction of available bandwidth to sessions that attempt to use less bandwidth, and is loosely based on the rationale behind some proposed solutions to the [cake-cutting](https://en.wikipedia.org/wiki/Fair_cake-cutting) problem.
|
||||||
|
|
||||||
The queue size is limited to 4 MB. If a packet is added to a queue and the total size of all queues is larger than this threshold, then a random queue is selected (with odds proportional to relative queue sizes), and the first packet from that queue is dropped, with the process repeated until the total queue size drops below the allowed threshold.
|
The queue size is limited to 4 MB. If a packet is added to a queue and the total size of all queues is larger than this threshold, then a random queue is selected (with odds proportional to relative queue sizes), and the first packet from that queue is dropped, with the process repeated until the total queue size drops below the allowed threshold.
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ def timelineDimesTest():
|
|||||||
store = makeStoreDimesEdges(path, bestRoot)
|
store = makeStoreDimesEdges(path, bestRoot)
|
||||||
rootID = "R" + bestRoot[1:]
|
rootID = "R" + bestRoot[1:]
|
||||||
assert rootID in store
|
assert rootID in store
|
||||||
# Don't forget to set random seed before setitng times
|
# Don't forget to set random seed before setting times
|
||||||
# To make results reproducible
|
# To make results reproducible
|
||||||
nodeIDs = sorted(store.keys())
|
nodeIDs = sorted(store.keys())
|
||||||
random.seed(12345)
|
random.seed(12345)
|
||||||
|
@ -424,7 +424,7 @@ func main() {
|
|||||||
//*/
|
//*/
|
||||||
startNetwork(kstore)
|
startNetwork(kstore)
|
||||||
//time.Sleep(10*time.Second)
|
//time.Sleep(10*time.Second)
|
||||||
// Note that testPaths only works if pressure is turend off
|
// Note that testPaths only works if pressure is turned off
|
||||||
// Otherwise congestion can lead to routing loops?
|
// Otherwise congestion can lead to routing loops?
|
||||||
for finished := false; !finished; {
|
for finished := false; !finished; {
|
||||||
finished = testPaths(kstore)
|
finished = testPaths(kstore)
|
||||||
|
@ -15,9 +15,9 @@ type Address [16]byte
|
|||||||
type Subnet [8]byte
|
type Subnet [8]byte
|
||||||
|
|
||||||
// GetPrefix returns the address prefix used by yggdrasil.
|
// GetPrefix returns the address prefix used by yggdrasil.
|
||||||
// The current implementation requires this to be a muliple of 8 bits + 7 bits.
|
// The current implementation requires this to be a multiple of 8 bits + 7 bits.
|
||||||
// The 8th bit of the last byte is used to signal nodes (0) or /64 prefixes (1).
|
// The 8th bit of the last byte is used to signal nodes (0) or /64 prefixes (1).
|
||||||
// Nodes that configure this differently will be unable to communicate with eachother using IP packets, though routing and the DHT machinery *should* still work.
|
// Nodes that configure this differently will be unable to communicate with each other using IP packets, though routing and the DHT machinery *should* still work.
|
||||||
func GetPrefix() [1]byte {
|
func GetPrefix() [1]byte {
|
||||||
return [...]byte{0x02}
|
return [...]byte{0x02}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ type NodeConfig struct {
|
|||||||
SigningPrivateKey string `comment:"Your private signing key. DO NOT share this with anyone!"`
|
SigningPrivateKey string `comment:"Your private signing key. DO NOT share this with anyone!"`
|
||||||
LinkLocalTCPPort uint16 `comment:"The port number to be used for the link-local TCP listeners for the\nconfigured MulticastInterfaces. This option does not affect listeners\nspecified in the Listen option. Unless you plan to firewall link-local\ntraffic, it is best to leave this as the default value of 0. This\noption cannot currently be changed by reloading config during runtime."`
|
LinkLocalTCPPort uint16 `comment:"The port number to be used for the link-local TCP listeners for the\nconfigured MulticastInterfaces. This option does not affect listeners\nspecified in the Listen option. Unless you plan to firewall link-local\ntraffic, it is best to leave this as the default value of 0. This\noption cannot currently be changed by reloading config during runtime."`
|
||||||
IfName string `comment:"Local network interface name for TUN adapter, or \"auto\" to select\nan interface automatically, or \"none\" to run without TUN."`
|
IfName string `comment:"Local network interface name for TUN adapter, or \"auto\" to select\nan interface automatically, or \"none\" to run without TUN."`
|
||||||
IfMTU int `comment:"Maximux Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
|
IfMTU int `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
|
||||||
SessionFirewall SessionFirewall `comment:"The session firewall controls who can send/receive network traffic\nto/from. This is useful if you want to protect this node without\nresorting to using a real firewall. This does not affect traffic\nbeing routed via this node to somewhere else. Rules are prioritised as\nfollows: blacklist, whitelist, always allow outgoing, direct, remote."`
|
SessionFirewall SessionFirewall `comment:"The session firewall controls who can send/receive network traffic\nto/from. This is useful if you want to protect this node without\nresorting to using a real firewall. This does not affect traffic\nbeing routed via this node to somewhere else. Rules are prioritised as\nfollows: blacklist, whitelist, always allow outgoing, direct, remote."`
|
||||||
TunnelRouting TunnelRouting `comment:"Allow tunneling non-Yggdrasil traffic over Yggdrasil. This effectively\nallows you to use Yggdrasil to route to, or to bridge other networks,\nsimilar to a VPN tunnel. Tunnelling works between any two nodes and\ndoes not require them to be directly peered."`
|
TunnelRouting TunnelRouting `comment:"Allow tunneling non-Yggdrasil traffic over Yggdrasil. This effectively\nallows you to use Yggdrasil to route to, or to bridge other networks,\nsimilar to a VPN tunnel. Tunnelling works between any two nodes and\ndoes not require them to be directly peered."`
|
||||||
SwitchOptions SwitchOptions `comment:"Advanced options for tuning the switch. Normally you will not need\nto edit these options."`
|
SwitchOptions SwitchOptions `comment:"Advanced options for tuning the switch. Normally you will not need\nto edit these options."`
|
||||||
|
@ -215,7 +215,7 @@ func GetSharedKey(myPrivKey *BoxPrivKey,
|
|||||||
return (*BoxSharedKey)(&shared)
|
return (*BoxSharedKey)(&shared)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BoxOpen returns a message and true if it successfull opens a crypto box using the provided shared key and nonce.
|
// BoxOpen returns a message and true if it successful opens a crypto box using the provided shared key and nonce.
|
||||||
func BoxOpen(shared *BoxSharedKey,
|
func BoxOpen(shared *BoxSharedKey,
|
||||||
boxed []byte,
|
boxed []byte,
|
||||||
nonce *BoxNonce) ([]byte, bool) {
|
nonce *BoxNonce) ([]byte, bool) {
|
||||||
|
@ -63,7 +63,7 @@ func (s *tunConn) _read(bs []byte) (err error) {
|
|||||||
default:
|
default:
|
||||||
isCGA = false
|
isCGA = false
|
||||||
}
|
}
|
||||||
// Check destiantion addresses
|
// Check destination addresses
|
||||||
switch {
|
switch {
|
||||||
case ipv6 && bs[24] == 0x02 && bytes.Equal(s.tun.addr[:16], bs[24:40]): // destination
|
case ipv6 && bs[24] == 0x02 && bytes.Equal(s.tun.addr[:16], bs[24:40]): // destination
|
||||||
case ipv6 && bs[24] == 0x03 && bytes.Equal(s.tun.subnet[:8], bs[24:32]): // destination
|
case ipv6 && bs[24] == 0x03 && bytes.Equal(s.tun.subnet[:8], bs[24:32]): // destination
|
||||||
|
@ -164,7 +164,7 @@ func (c *Conn) _getDeadlineCancellation(t *time.Time) (util.Cancellation, bool)
|
|||||||
c := util.CancellationWithDeadline(c.session.cancel, *t)
|
c := util.CancellationWithDeadline(c.session.cancel, *t)
|
||||||
return c, true
|
return c, true
|
||||||
} else {
|
} else {
|
||||||
// No deadline was set, so just return the existinc cancellation and a dummy value
|
// No deadline was set, so just return the existing cancellation and a dummy value
|
||||||
return c.session.cancel, false
|
return c.session.cancel, false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ func (c *Conn) _write(msg FlowKeyMessage) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WriteFrom should be called by a phony.Actor, and tells the Conn to send a
|
// WriteFrom should be called by a phony.Actor, and tells the Conn to send a
|
||||||
// message. This is used internaly by Write. If the callback is called with a
|
// message. This is used internally by Write. If the callback is called with a
|
||||||
// non-nil value, then it is safe to reuse the argument FlowKeyMessage.
|
// non-nil value, then it is safe to reuse the argument FlowKeyMessage.
|
||||||
func (c *Conn) WriteFrom(from phony.Actor, msg FlowKeyMessage, callback func(error)) {
|
func (c *Conn) WriteFrom(from phony.Actor, msg FlowKeyMessage, callback func(error)) {
|
||||||
c.Act(from, func() {
|
c.Act(from, func() {
|
||||||
|
@ -22,7 +22,7 @@ func GenerateConfig() *config.NodeConfig {
|
|||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLoggerWithPrefix creates a new logger instance wih prefix.
|
// GetLoggerWithPrefix creates a new logger instance with prefix.
|
||||||
// If verbose is set to true, three log levels are enabled: "info", "warn", "error".
|
// If verbose is set to true, three log levels are enabled: "info", "warn", "error".
|
||||||
func GetLoggerWithPrefix(prefix string, verbose bool) *log.Logger {
|
func GetLoggerWithPrefix(prefix string, verbose bool) *log.Logger {
|
||||||
l := log.New(os.Stderr, prefix, log.Flags())
|
l := log.New(os.Stderr, prefix, log.Flags())
|
||||||
|
@ -20,7 +20,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// dhtInfo represents everything we know about a node in the DHT.
|
// dhtInfo represents everything we know about a node in the DHT.
|
||||||
// This includes its key, a cache of it's NodeID, coords, and timing/ping related info for deciding who/when to ping nodes for maintenance.
|
// This includes its key, a cache of its NodeID, coords, and timing/ping related info for deciding who/when to ping nodes for maintenance.
|
||||||
type dhtInfo struct {
|
type dhtInfo struct {
|
||||||
nodeID_hidden *crypto.NodeID
|
nodeID_hidden *crypto.NodeID
|
||||||
key crypto.BoxPubKey
|
key crypto.BoxPubKey
|
||||||
|
@ -17,7 +17,7 @@ type Dialer struct {
|
|||||||
core *Core
|
core *Core
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dial opens a session to the given node. The first paramter should be "nodeid"
|
// Dial opens a session to the given node. The first parameter should be "nodeid"
|
||||||
// and the second parameter should contain a hexadecimal representation of the
|
// and the second parameter should contain a hexadecimal representation of the
|
||||||
// target node ID. It uses DialContext internally.
|
// target node ID. It uses DialContext internally.
|
||||||
func (d *Dialer) Dial(network, address string) (net.Conn, error) {
|
func (d *Dialer) Dial(network, address string) (net.Conn, error) {
|
||||||
|
@ -123,7 +123,7 @@ func (l *link) listen(uri string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *link) create(msgIO linkInterfaceMsgIO, name, linkType, local, remote string, incoming, force bool) (*linkInterface, error) {
|
func (l *link) create(msgIO linkInterfaceMsgIO, name, linkType, local, remote string, incoming, force bool) (*linkInterface, error) {
|
||||||
// Technically anything unique would work for names, but lets pick something human readable, just for debugging
|
// Technically anything unique would work for names, but let's pick something human readable, just for debugging
|
||||||
intf := linkInterface{
|
intf := linkInterface{
|
||||||
name: name,
|
name: name,
|
||||||
link: l,
|
link: l,
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
// The peers struct represents peers with an active connection.
|
// The peers struct represents peers with an active connection.
|
||||||
// Incoming packets are passed to the corresponding peer, which handles them somehow.
|
// Incoming packets are passed to the corresponding peer, which handles them somehow.
|
||||||
// In most cases, this involves passing the packet to the handler for outgoing traffic to another peer.
|
// In most cases, this involves passing the packet to the handler for outgoing traffic to another peer.
|
||||||
// In other cases, it's link protocol traffic used to build the spanning tree, in which case this checks signatures and passes the message along to the switch.
|
// In other cases, its link protocol traffic is used to build the spanning tree, in which case this checks signatures and passes the message along to the switch.
|
||||||
type peers struct {
|
type peers struct {
|
||||||
core *Core
|
core *Core
|
||||||
mutex sync.Mutex // Synchronize writes to atomic
|
mutex sync.Mutex // Synchronize writes to atomic
|
||||||
@ -90,7 +90,7 @@ func (ps *peers) putPorts(ports map[switchPort]*peer) {
|
|||||||
ps.ports.Store(ports)
|
ps.ports.Store(ports)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information known about a peer, including thier box/sig keys, precomputed shared keys (static and ephemeral) and a handler for their outgoing traffic
|
// Information known about a peer, including their box/sig keys, precomputed shared keys (static and ephemeral) and a handler for their outgoing traffic
|
||||||
type peer struct {
|
type peer struct {
|
||||||
phony.Inbox
|
phony.Inbox
|
||||||
core *Core
|
core *Core
|
||||||
@ -356,7 +356,7 @@ func (p *peer) _handleSwitchMsg(packet []byte) {
|
|||||||
p.dinfo = nil
|
p.dinfo = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Pass a mesage to the dht informing it that this peer (still) exists
|
// Pass a message to the dht informing it that this peer (still) exists
|
||||||
loc.coords = loc.coords[:len(loc.coords)-1]
|
loc.coords = loc.coords[:len(loc.coords)-1]
|
||||||
p.dinfo = &dhtInfo{
|
p.dinfo = &dhtInfo{
|
||||||
key: p.box,
|
key: p.box,
|
||||||
|
@ -144,7 +144,7 @@ func (sinfo *searchInfo) doSearchStep() {
|
|||||||
sinfo.time = time.Now()
|
sinfo.time = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we've recenty sent a ping for this search, do nothing.
|
// If we've recently sent a ping for this search, do nothing.
|
||||||
// Otherwise, doSearchStep and schedule another continueSearch to happen after search_RETRY_TIME.
|
// Otherwise, doSearchStep and schedule another continueSearch to happen after search_RETRY_TIME.
|
||||||
func (sinfo *searchInfo) continueSearch() {
|
func (sinfo *searchInfo) continueSearch() {
|
||||||
sinfo.doSearchStep()
|
sinfo.doSearchStep()
|
||||||
|
@ -39,7 +39,7 @@ type sessionInfo struct {
|
|||||||
theirMTU uint16 //
|
theirMTU uint16 //
|
||||||
myMTU uint16 //
|
myMTU uint16 //
|
||||||
wasMTUFixed bool // Was the MTU fixed by a receive error?
|
wasMTUFixed bool // Was the MTU fixed by a receive error?
|
||||||
timeOpened time.Time // Time the sessino was opened
|
timeOpened time.Time // Time the session was opened
|
||||||
time time.Time // Time we last received a packet
|
time time.Time // Time we last received a packet
|
||||||
mtuTime time.Time // time myMTU was last changed
|
mtuTime time.Time // time myMTU was last changed
|
||||||
pingTime time.Time // time the first ping was sent since the last received packet
|
pingTime time.Time // time the first ping was sent since the last received packet
|
||||||
@ -55,7 +55,7 @@ type sessionInfo struct {
|
|||||||
callbacks []chan func() // Finished work from crypto workers
|
callbacks []chan func() // Finished work from crypto workers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a session ping/pong packet, andincludes information like public keys, a session handle, coords, a timestamp to prevent replays, and the tun/tap MTU.
|
// Represents a session ping/pong packet, and includes information like public keys, a session handle, coords, a timestamp to prevent replays, and the tun/tap MTU.
|
||||||
type sessionPing struct {
|
type sessionPing struct {
|
||||||
SendPermPub crypto.BoxPubKey // Sender's permanent key
|
SendPermPub crypto.BoxPubKey // Sender's permanent key
|
||||||
Handle crypto.Handle // Random number to ID session
|
Handle crypto.Handle // Random number to ID session
|
||||||
@ -175,7 +175,7 @@ func (ss *sessions) getByTheirPerm(key *crypto.BoxPubKey) (*sessionInfo, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new session and lazily cleans up old existing sessions. This
|
// Creates a new session and lazily cleans up old existing sessions. This
|
||||||
// includse initializing session info to sane defaults (e.g. lowest supported
|
// includes initializing session info to sane defaults (e.g. lowest supported
|
||||||
// MTU).
|
// MTU).
|
||||||
func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
|
func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
|
||||||
// TODO: this check definitely needs to be moved
|
// TODO: this check definitely needs to be moved
|
||||||
@ -415,7 +415,7 @@ func (sinfo *sessionInfo) _updateNonce(theirNonce *crypto.BoxNonce) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resets all sessions to an uninitialized state.
|
// Resets all sessions to an uninitialized state.
|
||||||
// Called after coord changes, so attemtps to use a session will trigger a new ping and notify the remote end of the coord change.
|
// Called after coord changes, so attempts to use a session will trigger a new ping and notify the remote end of the coord change.
|
||||||
// Only call this from the router actor.
|
// Only call this from the router actor.
|
||||||
func (ss *sessions) reset() {
|
func (ss *sessions) reset() {
|
||||||
for _, _sinfo := range ss.sinfos {
|
for _, _sinfo := range ss.sinfos {
|
||||||
|
@ -107,7 +107,7 @@ func (l *switchLocator) getCoords() []byte {
|
|||||||
return bs
|
return bs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the this locator represents an ancestor of the locator given as an argument.
|
// Returns true if this locator represents an ancestor of the locator given as an argument.
|
||||||
// Ancestor means that it's the parent node, or the parent of parent, and so on...
|
// Ancestor means that it's the parent node, or the parent of parent, and so on...
|
||||||
func (x *switchLocator) isAncestorOf(y *switchLocator) bool {
|
func (x *switchLocator) isAncestorOf(y *switchLocator) bool {
|
||||||
if x.root != y.root {
|
if x.root != y.root {
|
||||||
@ -381,7 +381,7 @@ func (t *switchTable) handleMsg(msg *switchMsg, fromPort switchPort) {
|
|||||||
// Then the tricky part, it decides if it should update our own locator as a result.
|
// Then the tricky part, it decides if it should update our own locator as a result.
|
||||||
// That happens if this node is already our parent, or is advertising a better root, or is advertising a better path to the same root, etc...
|
// That happens if this node is already our parent, or is advertising a better root, or is advertising a better path to the same root, etc...
|
||||||
// There are a lot of very delicate order sensitive checks here, so its' best to just read the code if you need to understand what it's doing.
|
// There are a lot of very delicate order sensitive checks here, so its' best to just read the code if you need to understand what it's doing.
|
||||||
// It's very important to not change the order of the statements in the case function unless you're absolutely sure that it's safe, including safe if used along side nodes that used the previous order.
|
// It's very important to not change the order of the statements in the case function unless you're absolutely sure that it's safe, including safe if used alongside nodes that used the previous order.
|
||||||
// Set the third arg to true if you're reprocessing an old message, e.g. to find a new parent after one disconnects, to avoid updating some timing related things.
|
// Set the third arg to true if you're reprocessing an old message, e.g. to find a new parent after one disconnects, to avoid updating some timing related things.
|
||||||
func (t *switchTable) unlockedHandleMsg(msg *switchMsg, fromPort switchPort, reprocessing bool) {
|
func (t *switchTable) unlockedHandleMsg(msg *switchMsg, fromPort switchPort, reprocessing bool) {
|
||||||
// TODO directly use a switchMsg instead of switchMessage + sigs
|
// TODO directly use a switchMsg instead of switchMessage + sigs
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package yggdrasil
|
package yggdrasil
|
||||||
|
|
||||||
// This file contains the version metadata struct
|
// This file contains the version metadata struct
|
||||||
// Used in the inital connection setup and key exchange
|
// Used in the initial connection setup and key exchange
|
||||||
// Some of this could arguably go in wire.go instead
|
// Some of this could arguably go in wire.go instead
|
||||||
|
|
||||||
import "github.com/yggdrasil-network/yggdrasil-go/src/crypto"
|
import "github.com/yggdrasil-network/yggdrasil-go/src/crypto"
|
||||||
|
|
||||||
// This is the version-specific metadata exchanged at the start of a connection.
|
// This is the version-specific metadata exchanged at the start of a connection.
|
||||||
// It must always beign with the 4 bytes "meta" and a wire formatted uint64 major version number.
|
// It must always begin with the 4 bytes "meta" and a wire formatted uint64 major version number.
|
||||||
// The current version also includes a minor version number, and the box/sig/link keys that need to be exchanged to open an connection.
|
// The current version also includes a minor version number, and the box/sig/link keys that need to be exchanged to open a connection.
|
||||||
type version_metadata struct {
|
type version_metadata struct {
|
||||||
meta [4]byte
|
meta [4]byte
|
||||||
ver uint64 // 1 byte in this version
|
ver uint64 // 1 byte in this version
|
||||||
|
Loading…
Reference in New Issue
Block a user