mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/yggdrasil-network/yggdrasil-go into yggdrasil-v0.4.6.1-develop
This commit is contained in:
		
						commit
						69d59458d8
					
				
					 6 changed files with 30 additions and 11 deletions
				
			
		| 
						 | 
					@ -348,7 +348,7 @@ func run(args yggArgs, ctx context.Context) {
 | 
				
			||||||
				Beacon: intf.Beacon,
 | 
									Beacon: intf.Beacon,
 | 
				
			||||||
				Listen: intf.Listen,
 | 
									Listen: intf.Listen,
 | 
				
			||||||
				Port: intf.Port,
 | 
									Port: intf.Port,
 | 
				
			||||||
				Priority: intf.Priority,
 | 
									Priority: uint8(intf.Priority),
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if n.multicast, err = multicast.New(n.core, logger, options...); err != nil {
 | 
							if n.multicast, err = multicast.New(n.core, logger, options...); err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,7 @@ func (m *Mesh) StartJSON(configjson []byte) error {
 | 
				
			||||||
				Beacon: intf.Beacon,
 | 
									Beacon: intf.Beacon,
 | 
				
			||||||
				Listen: intf.Listen,
 | 
									Listen: intf.Listen,
 | 
				
			||||||
				Port: intf.Port,
 | 
									Port: intf.Port,
 | 
				
			||||||
				Priority: intf.Priority,
 | 
									Priority: uint8(intf.Priority),
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		m.multicast, err = multicast.New(m.core, logger, options...)
 | 
							m.multicast, err = multicast.New(m.core, logger, options...)
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,19 @@ func (m *Mesh) Send(p []byte) error {
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Recv waits for and reads a packet coming from Mesh. It
 | 
					// Send sends a packet from given buffer to Yggdrasil. From first byte up to length.
 | 
				
			||||||
 | 
					func (m *Mesh) SendBuffer(p []byte, length int) error {
 | 
				
			||||||
 | 
						if m.iprwc == nil {
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if len(p) < length {
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						_, _ = m.iprwc.Write(p[:length])
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Recv waits for and reads a packet coming from Yggdrasil. It
 | 
				
			||||||
// will be a fully formed IPv6 packet
 | 
					// will be a fully formed IPv6 packet
 | 
				
			||||||
func (m *Mesh) Recv() ([]byte, error) {
 | 
					func (m *Mesh) Recv() ([]byte, error) {
 | 
				
			||||||
	if m.iprwc == nil {
 | 
						if m.iprwc == nil {
 | 
				
			||||||
| 
						 | 
					@ -126,6 +138,15 @@ func (m *Mesh) Recv() ([]byte, error) {
 | 
				
			||||||
	return buf[:n], nil
 | 
						return buf[:n], nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Recv waits for and reads a packet coming from Yggdrasil to given buffer, returning size of packet
 | 
				
			||||||
 | 
					func (m *Yggdrasil) RecvBuffer(buf []byte) (int, error) {
 | 
				
			||||||
 | 
						if m.iprwc == nil {
 | 
				
			||||||
 | 
							return 0, nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						n, _ := m.iprwc.Read(buf)
 | 
				
			||||||
 | 
						return n, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Stop the mobile Mesh instance
 | 
					// Stop the mobile Mesh instance
 | 
				
			||||||
func (m *Mesh) Stop() error {
 | 
					func (m *Mesh) Stop() error {
 | 
				
			||||||
	logger := log.New(m.log, "", 0)
 | 
						logger := log.New(m.log, "", 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								go.mod
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								go.mod
									
										
									
									
									
								
							| 
						 | 
					@ -12,9 +12,8 @@ require (
 | 
				
			||||||
	github.com/kardianos/minwinsvc v1.0.2
 | 
						github.com/kardianos/minwinsvc v1.0.2
 | 
				
			||||||
	github.com/mitchellh/mapstructure v1.4.1
 | 
						github.com/mitchellh/mapstructure v1.4.1
 | 
				
			||||||
	github.com/vishvananda/netlink v1.1.0
 | 
						github.com/vishvananda/netlink v1.1.0
 | 
				
			||||||
 | 
					 | 
				
			||||||
	github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e
 | 
						github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e
 | 
				
			||||||
	golang.org/x/mobile v0.0.0-20221012134814-c746ac228303
 | 
						golang.org/x/mobile v0.0.0-20221020085226-b36e6246172e
 | 
				
			||||||
	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b
 | 
						golang.org/x/net v0.0.0-20221014081412-f15817d10f9b
 | 
				
			||||||
	golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43
 | 
						golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43
 | 
				
			||||||
	golang.org/x/text v0.3.8
 | 
						golang.org/x/text v0.3.8
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								go.sum
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								go.sum
									
										
									
									
									
								
							| 
						 | 
					@ -125,8 +125,8 @@ golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMx
 | 
				
			||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
 | 
					golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
 | 
				
			||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
 | 
					golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
 | 
				
			||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
 | 
					golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
 | 
				
			||||||
golang.org/x/mobile v0.0.0-20221012134814-c746ac228303 h1:K4fp1rDuJBz0FCPAWzIJwnzwNEM7S6yobdZzMrZ/Zws=
 | 
					golang.org/x/mobile v0.0.0-20221020085226-b36e6246172e h1:zSgtO19fpg781xknwqiQPmOHaASr6E7ZVlTseLd9Fx4=
 | 
				
			||||||
golang.org/x/mobile v0.0.0-20221012134814-c746ac228303/go.mod h1:M32cGdzp91A8Ex9qQtyZinr19EYxzkFqDjW2oyHzTDQ=
 | 
					golang.org/x/mobile v0.0.0-20221020085226-b36e6246172e/go.mod h1:aAjjkJNdrh3PMckS4B10TGS2nag27cbKR1y2BpUxsiY=
 | 
				
			||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
 | 
					golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
 | 
				
			||||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 | 
					golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 | 
				
			||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
 | 
					golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
 | 
				
			||||||
| 
						 | 
					@ -183,7 +183,6 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3
 | 
				
			||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 | 
					golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 | 
				
			||||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 | 
					golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 | 
				
			||||||
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
 | 
					golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
 | 
				
			||||||
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
 | 
					 | 
				
			||||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
 | 
					golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
 | 
				
			||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
 | 
					golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
 | 
				
			||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
					golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@ type PeerEntry struct {
 | 
				
			||||||
	IPAddress string   `json:"address"`
 | 
						IPAddress string   `json:"address"`
 | 
				
			||||||
	PublicKey string   `json:"key"`
 | 
						PublicKey string   `json:"key"`
 | 
				
			||||||
	Port      uint64   `json:"port"`
 | 
						Port      uint64   `json:"port"`
 | 
				
			||||||
	Priority  uint8    `json:"priority"`
 | 
						Priority  uint64   `json:"priority"`
 | 
				
			||||||
	Coords    []uint64 `json:"coords"`
 | 
						Coords    []uint64 `json:"coords"`
 | 
				
			||||||
	Remote    string   `json:"remote"`
 | 
						Remote    string   `json:"remote"`
 | 
				
			||||||
	RXBytes   DataUnit `json:"bytes_recvd"`
 | 
						RXBytes   DataUnit `json:"bytes_recvd"`
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersRespons
 | 
				
			||||||
			IPAddress: net.IP(addr[:]).String(),
 | 
								IPAddress: net.IP(addr[:]).String(),
 | 
				
			||||||
			PublicKey: hex.EncodeToString(p.Key),
 | 
								PublicKey: hex.EncodeToString(p.Key),
 | 
				
			||||||
			Port:      p.Port,
 | 
								Port:      p.Port,
 | 
				
			||||||
			Priority:  p.Priority,
 | 
								Priority:  uint64(p.Priority), // can't be uint8 thanks to gobind
 | 
				
			||||||
			Coords:    p.Coords,
 | 
								Coords:    p.Coords,
 | 
				
			||||||
			Remote:    p.Remote,
 | 
								Remote:    p.Remote,
 | 
				
			||||||
			RXBytes:   DataUnit(p.RXBytes),
 | 
								RXBytes:   DataUnit(p.RXBytes),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ type MulticastInterfaceConfig struct {
 | 
				
			||||||
	Beacon bool
 | 
						Beacon bool
 | 
				
			||||||
	Listen bool
 | 
						Listen bool
 | 
				
			||||||
	Port uint16
 | 
						Port uint16
 | 
				
			||||||
	Priority uint8
 | 
						Priority uint64 // really uint8, but gobind won't export it
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type NetworkDomainConfig struct {
 | 
					type NetworkDomainConfig struct {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue