Commit Graph

429 Commits

Author SHA1 Message Date
Astone
55a15ecf12 fix tiny error in linting fixes 2019-12-09 11:18:45 +08:00
Asim Aslam
6064e1426c fix some potential go routine leaks 2019-12-08 15:02:54 +00:00
Asim Aslam
d28a868e46 Fix network startup connect 2019-12-08 14:37:17 +00:00
Asim Aslam
ce578800d0 n.initNodes 2019-12-08 12:17:31 +00:00
Asim Aslam
6307d6ba51 further cleanup of tunnel/network 2019-12-08 12:12:20 +00:00
Asim Aslam
283c85d256 done 2019-12-08 00:53:55 +00:00
Asim Aslam
9bd0fb9125 save changes 2019-12-07 23:28:39 +00:00
Asim Aslam
c445aed6b1 Cleanup and speedup network convergence along with direct messaging for connect and solicit 2019-12-07 19:54:29 +00:00
Asim Aslam
1d8c66780e save working solution 2019-12-06 00:18:40 +00:00
Asim Aslam
b0626089f3
Merge pull request #1016 from unistack-org/lint
lint fixes mostly for prealloc also remove deadcode from grpc client
2019-12-05 08:33:52 +00:00
a1eaf9cc20 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-04 00:22:02 +03:00
Asim Aslam
3f8af8c1e0 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-12-03 20:32:10 +00:00
Asim Aslam
becaeefcba Revert. DO NOT peer solicit until we know better 2019-12-03 20:32:02 +00:00
Asim Aslam
bb1a1358b7
Merge pull request #1012 from Astone-Chou/lint
improve code quality
2019-12-03 13:10:04 +00:00
Astone
29fb58db39 improve code quality 2019-12-03 20:59:02 +08:00
Asim Aslam
2c0801fc1c couple bug fixes in tunnel 2019-12-03 08:11:36 +00:00
Asim Aslam
5f04fd58ab optimizations to connect fast 2019-12-02 18:48:19 +00:00
Asim Aslam
c840cee404 A variety of fixes to try combat the multicast issue 2019-12-01 19:36:16 +00:00
Asim Aslam
8b63df7a98 regenerate the protos 2019-11-26 13:53:33 +00:00
Asim Aslam
080363e8c4
The mega cruft proxy PR (#974)
* the mega cruft proxy PR

* Rename broker id

* add protocol=grpc

* fix compilation breaks

* Add the tunnel broker to the network

* fix broker id

* continue to be backwards compatible in the protocol
2019-11-25 16:31:43 +00:00
Asim Aslam
cffa5b6b50 Make use of cloudflare 1.0.0.1 by default to resolve addresses 2019-11-12 15:46:30 +00:00
Till Knuesting
5ae3e179b9 preallocated slices (#934) 2019-11-11 00:03:51 +00:00
Till Knuesting
f67c5e779f preallocated slices (#917) 2019-11-05 17:43:12 +00:00
Till Knuesting
24b8d2a315 preallocating slices (#904)
* preallocated some slices when size is known

* gofmt

* gofmt
2019-11-04 10:33:53 +00:00
Asim Aslam
45cd14c4b7 Suppress log messages 2019-11-03 16:12:17 +00:00
Asim Aslam
174fbde049 add ability to filter routes based on headers 2019-10-31 22:34:06 +00:00
Asim Aslam
d89256d8d5 add network resolver record priority field 2019-10-28 15:31:46 +00:00
Asim Aslam
b42d242ec1 hash address based on service name + node address 2019-10-25 23:06:49 +01:00
Asim Aslam
f26d470db1 A few changes for the network / tunnel link state 2019-10-24 17:51:41 +01:00
Milos Gajdos
4f1dd3f965
Fixed a small messup when printing logs 2019-10-23 20:01:45 +01:00
Milos Gajdos
71122836b8
Use event.Route.Link for getting the route metrics 2019-10-23 19:55:01 +01:00
Milos Gajdos
b67be88952
Check for local links and empty gateways 2019-10-23 19:48:26 +01:00
Milos Gajdos
776284b187
Make sure you dont overflow MaxInt64 2019-10-23 17:42:04 +01:00
Milos Gajdos
35729092e0
Unexport network.Message 2019-10-23 17:32:45 +01:00
Milos Gajdos
68789af4ea
Prune peerlinks of pruned nodes 2019-10-23 17:29:03 +01:00
Milos Gajdos
b3d4a7f740
If no link found, return max possible value 2019-10-23 16:51:22 +01:00
Milos Gajdos
f4f178c130
Set metric on egress. Increment metric on ingress. 2019-10-23 16:51:22 +01:00
Milos Gajdos
1ff65e140a
Change router.Route metric to int64. Set the route metric properly 2019-10-23 16:51:22 +01:00
Milos Gajdos
326156671d
Set route metric to link Length 2019-10-23 16:51:22 +01:00
Milos Gajdos
6353b2b894
Keep track of peer links 2019-10-23 16:51:22 +01:00
Milos Gajdos
3d5d9be02a
Avoid recursive calls to RLock()
Topology calls itsel recursively invoking RLock. This, according to go
documentation is wrong. This commit moves the body of Topology function
to a non-thread safe unexported function to keep locsk at check!
2019-10-18 11:26:43 +01:00
Asim Aslam
5c38f38dd9
No need to lock here since Topology read locks and makes copies 2019-10-18 11:26:43 +01:00
Milos Gajdos
2ae583ce94
Cleanup of tunnel dial code. Clean up network channel processors 2019-10-16 20:44:22 +01:00
Asim Aslam
b1d5dc20fa
Merge pull request #860 from micro/tunnel-mode
Tunnel mode
2019-10-15 16:14:38 +01:00
Asim Aslam
be5093798b Use DialMode/ListenMode 2019-10-15 16:08:38 +01:00
Milos Gajdos
4936a2e1a5
Exponential backoff for failed accept connections 2019-10-15 15:58:33 +01:00
Asim Aslam
ca934951ad Use multicast on network/control channels 2019-10-15 15:57:13 +01:00
Milos Gajdos
fed5af68e6
Handle Accept errors gracefully.
Originally when Accept fails we log the error and let the program flow
continue. This can lead to us spawning handling connection go routines
on nil connections which in turn leads to Go panics.
2019-10-15 15:07:28 +01:00
Asim Aslam
b1fed01752 add network name to node 2019-10-14 22:26:23 +01:00
Asim Aslam
f77df51f60 Support reconnects 2019-10-13 18:36:22 +01:00
Asim Aslam
d6c6e7815e Spaces not tabs 2019-10-13 12:40:53 +01:00
Asim Aslam
01492997ea add Network.Init method 2019-10-13 12:38:13 +01:00
Asim Aslam
174f1b857c Network handler moves to service/handler 2019-10-13 12:37:56 +01:00
Asim Aslam
5029d80e68 add Network.Connect handler and network/metadata fields to node 2019-10-13 12:37:39 +01:00
Asim Aslam
b59c5a4488 move network handler to service/handler 2019-10-13 12:37:13 +01:00
Asim Aslam
2e47fdc6f5 Check the node map to avoid dupes in resolved nodes 2019-10-12 20:26:06 +01:00
Milos Gajdos
f6931f3da7
Prune routes from routers that are not in your peer graph 2019-10-10 15:28:27 +01:00
Asim Aslam
b2f99a27b7 Visit all the nodes in flatten 2019-10-10 14:35:11 +01:00
Asim Aslam
0dee11e006 Prune the peer address 2019-10-10 11:25:28 +01:00
Asim Aslam
fe94237448
Update router querying method (#834)
* Add address to router query options. Drop Query interface for QueryOptions

* Cleanup isMatch function

* Update network proto
2019-10-09 17:13:52 +01:00
Milos Gajdos
fe5846603a
Only limit the number of nodes returned by network resolver. 2019-10-08 15:48:52 +01:00
Milos Gajdos
61800fb7d7
Fix typo: MaxCconnections -> MaxConnections 2019-10-08 15:15:50 +01:00
Milos Gajdos
ec2fbde979
Limit the number of outbound connections to MaxConnections
This commit also fixes control channel shenanigans:
- recover error in control channel accept
2019-10-08 14:48:04 +01:00
Asim Aslam
94adeebed4 Use dns resolver on peer nodes 2019-10-08 09:25:23 +01:00
Asim Aslam
ad823d5177 Add dns net.LookupHost resolver! 2019-10-08 09:04:13 +01:00
Milos Gajdos
9d9683b6f9
Recover net channel Accept errors. Init tunnel nodes before Connect 2019-10-07 19:09:04 +01:00
Asim Aslam
3c6b6553fb Use peerAddress as the thing to listen on 2019-10-03 18:35:54 +01:00
Asim Aslam
2244eb8597 Advertise your peer address as advertised address 2019-10-03 17:37:29 +01:00
Asim Aslam
2370fb1209 Set gateway to node address rather than id 2019-10-02 15:52:31 +01:00
Asim Aslam
308424488b Hash the network address 2019-10-02 15:22:44 +01:00
Asim Aslam
b90871c241 Add Network.Services handler 2019-09-30 07:51:13 +01:00
Milos Gajdos
77f3e7ef48
Simplified table code. Fixed event dedup. 2019-09-26 11:56:30 +01:00
Asim Aslam
dfcedbab1e In case of non 200 response return error 2019-09-25 16:53:06 +01:00
Asim Aslam
ae40553bad only solicit the first time seeing a peer 2019-09-25 14:30:35 +01:00
Asim Aslam
f23c6d91ba Do not embed proxy/router/tunnel 2019-09-25 12:56:52 +01:00
Asim Aslam
d8dc713e2d Fix the http resolver to use micro.mu url 2019-09-23 17:50:53 +01:00
Asim Aslam
4260913b45 Set rpc methods as Network.Graph/Nodes/Routes 2019-09-23 15:41:05 +01:00
Asim Aslam
f13887f604 Only hash address if its a local route 2019-09-20 09:40:55 +01:00
Asim Aslam
66769e671f
Merge pull request #772 from micro/peers
Replace Nodes with Peers
2019-09-19 16:53:17 +01:00
Asim Aslam
7e05d2c440 Replace Nodes with Peers 2019-09-19 16:32:15 +01:00
Milos Gajdos
a38482ffcb
Remove data race; Unlock once done pruning/deleting 2019-09-19 11:53:13 +01:00
Asim Aslam
6222bc2a1e only set tunnel address if advertise is blank 2019-09-18 19:04:22 +01:00
Asim Aslam
05e62a2b95 allow setting advertise address 2019-09-18 18:56:02 +01:00
Milos Gajdos
38d6ffdf9a
Hash the service address before advertising it to the network. 2019-09-17 18:34:06 +01:00
Asim Aslam
e586763301
Merge pull request #761 from milosgajdos83/delete-peer-gw
Delete dead peer [gateway] routes
2019-09-17 16:54:35 +01:00
Milos Gajdos
3201b4cb36
Gateway is now set to node Id, hence we prune peer.id Gateway 2019-09-17 16:31:33 +01:00
Milos Gajdos
21dc7bcccf
Fix gateway addressing
- Set Gateway as node.ID when advertising
- Set server.Address as node.ID to listen on
- Set server.Advertise as node.Address
2019-09-17 16:11:02 +01:00
Asim Aslam
9147d378bc Set node address to tunnel address 2019-09-17 15:40:00 +01:00
Milos Gajdos
a72a2f717d
Prune stale nodes in the whole topology. 2019-09-16 19:22:55 +01:00
Milos Gajdos
2599ee8591
Prune routes routable via dead node. 2019-09-15 12:17:12 +01:00
Milos Gajdos
ccb6778f7f
Skip processing Advert which carries no events 2019-09-13 20:46:14 +01:00
Asim Aslam
b23ee58865
Update default.go 2019-09-13 11:55:53 -07:00
Milos Gajdos
323a72be34
Small refactoring; Split horizon loop break. 2019-09-13 18:46:24 +01:00
Milos Gajdos
d72e91fb38
Unlock on return from network.Connect 2019-09-13 03:31:58 +01:00
Milos Gajdos
b91c3147e7
Node API allows us to drop all network locks
Network locks are now needed only when accessing client map. node map
access is serialied with the node mutex.
2019-09-13 03:03:56 +01:00
Milos Gajdos
77c6c9781b
getProtoTopology has been replaced by PeersToProto
This helps us remove redundant code across node and handler
2019-09-13 03:03:56 +01:00
Milos Gajdos
fa4ff8921e
Removed redundant lock. Simplified proto topology 2019-09-13 03:03:56 +01:00
Milos Gajdos
d6be91e8af
Changed RPC methods. Changed Network interface.
* Nodes/Topology removed from public methods from Network interface
* Peers() returns max depth 3 topology
* handler.Topology rpc endpoint removed
* handler.Peers rpc endpoint accept "depth" param to return max depth peers
2019-09-13 03:03:56 +01:00
Milos Gajdos
588484c3bf
Fixed some races. Added more tests. 2019-09-13 03:03:56 +01:00
Milos Gajdos
d58eb51976
Code change to make Solicit router.proto message 2019-09-13 03:03:55 +01:00
Milos Gajdos
35cf2a5739
Make topology test more generic 2019-09-13 03:03:55 +01:00
Milos Gajdos
2dfbe93d65
Added more node tests. Small refactoring of Netowkr and handler. 2019-09-13 03:03:55 +01:00
Milos Gajdos
16fcf1fbda
Nodes, Peers and Topology methods for node
Topology accepts an argument to define the depth of the topology
requested from the network. proto definitions have been modified
accordingly, too.
2019-09-13 03:03:55 +01:00
Milos Gajdos
cbce5490d7
Lock the Nodes method properly when collecting them. 2019-09-13 03:03:55 +01:00
Milos Gajdos
4c709f7ac1
Write Lock() advert update: we are writing into peers map here 2019-09-13 03:03:55 +01:00
Milos Gajdos
baf4c05663
Send solicit message to ControlChannel 2019-09-13 03:03:55 +01:00
Milos Gajdos
195c6a8c90
Neighbour is now peer. Neighbourhood is Peers. Small refactor. 2019-09-13 03:03:54 +01:00
Milos Gajdos
f91d0408ab
Moved node implementation into dedicated source file 2019-09-13 03:03:54 +01:00
Milos Gajdos
eec780aaa7
Update neighbours when neighbour message is received 2019-09-13 03:03:54 +01:00
Milos Gajdos
f0a1031e97
Adding new peers up to given depth. Outline of node gaph Update 2019-09-13 03:03:54 +01:00
Asim Aslam
b5eea02f7a Move link to tunnel/ 2019-09-10 08:12:28 -07:00
Asim Aslam
e8aaca27d3 unlock before sending the message to avoid deadlock 2019-09-06 16:57:17 +01:00
Milos Gajdos
7971b1b7f9
Remove debug logs 2019-09-06 15:12:23 +01:00
Milos Gajdos
dafbacbdcb
Properly handle the list of the nodes. Send solicit on ControlChannel 2019-09-06 15:09:49 +01:00
Milos Gajdos
dddfb6f878
Fixed typos and simplified map iteration 2019-09-05 17:59:14 +01:00
Milos Gajdos
ec354934e3
Move Errors to separate init block 2019-09-05 17:44:47 +01:00
Milos Gajdos
b01c8e06e0
Update error name to ErrClientNotFound 2019-09-05 17:43:59 +01:00
Milos Gajdos
5ddfd911ba
Replace send message code by one network method 2019-09-05 17:18:16 +01:00
Milos Gajdos
2522d8cb96
Send solicit message when new neighbour is discovered 2019-09-05 16:04:44 +01:00
Milos Gajdos
4b1a7abb42
Freeze network graph when building full network topology
Also added some comments and debug logs
2019-09-05 00:16:22 +01:00
Asim Aslam
46a9767648
Merge pull request #730 from milosgajdos83/advert-lastseen
Update node.lastSeen properly. Set node.lastSeen when processing advert
2019-09-04 18:13:43 +01:00
Milos Gajdos
dd9f42e3b9
Update lastSeen timestamp properly. Set lastSeen when processing advert 2019-09-04 18:02:13 +01:00
Asim Aslam
f2c8492c77
Merge pull request #729 from micro/tunnel
Tunnel session management and unicast/multicast
2019-09-04 16:25:38 +01:00
Asim Aslam
b9c437fbfe Tunnel discover/announce/open/session/close 2019-09-04 09:48:05 +01:00
Milos Gajdos
4f4b3d3bae
Send connect message to NetworkChannel once we are not at caller mercy 2019-09-03 19:51:52 +01:00
Milos Gajdos
6eb6d050ed
Major bug overhaul in how we handle network.Nodes and related handler 2019-09-03 16:39:27 +01:00
Milos Gajdos
3ea4490d6c
Don't preallocate the slice if you don't index later on. 2019-09-03 15:02:30 +01:00
Milos Gajdos
ec6318befc
Prune nodes that have not announced themselves for certain time period. 2019-09-03 10:00:14 +01:00
Milos Gajdos
fb13877904
Make Nodes() BFS implementation efficient 2019-09-03 02:58:17 +01:00
Milos Gajdos
a8d4299df9
Sort the returned slice of nodes before searching
See docs:
https://golang.org/pkg/sort/#Search
2019-09-02 20:00:52 +01:00
Milos Gajdos
86665454e7
Implementation of Nodes method. First take on full handler 2019-09-02 17:06:21 +01:00
Milos Gajdos
4f5a849211
Added Nodes method to Network interface 2019-09-02 12:40:05 +01:00
Milos Gajdos
bf53c16e4b
Rough outline of Network introspection interface 2019-09-02 12:40:05 +01:00
Asim Aslam
6fa9d7270f Rename Tunnel ID to Channel 2019-08-30 20:05:00 +01:00
Milos Gajdos
b37837ad92
Add proto definitions for network introspection. 2019-08-30 12:29:26 +01:00
Milos Gajdos
e955e3f798
Avoid routes that route back to node without its being direct GW to dest 2019-08-30 00:04:46 +01:00
Milos Gajdos
ffa6b551f4
Don't override the neighbours. 2019-08-29 15:42:07 +01:00
Asim Aslam
3d03fe4076 Fix panic for nil slice 2019-08-29 15:09:01 +01:00
Asim Aslam
7479515099 add the ability to provide seed nodes to the network 2019-08-29 14:53:30 +01:00
Milos Gajdos
8606f1e143
Set the route.Metric before updating routing table 2019-08-29 11:45:47 +01:00
Milos Gajdos
db8e2620cb
Make tunnel channel clients key-able. Neighbour map simplified.
tunClient is a map of tunnel clients keyed on tunnel channel name.
Neighbour map is now a cimple map of nodes which contains its nodes.
2019-08-28 23:11:26 +01:00
Milos Gajdos
d09b7dbbef
Broadcast neighbourhood; fix critical bugs in channel connections
This commit introduces neighbourhood announcements which allows to
maintaing neighbour map if each next-hop node.

It also fixes a critical bug when accepting connections for a particular
tunnel channel.
2019-08-28 20:11:19 +01:00
Asim Aslam
a4f5772555 add network field to the routes 2019-08-28 08:41:19 +01:00
Milos Gajdos
5e7208119e
Adds network id. Skips processing routes when router is the origin. 2019-08-27 23:08:35 +01:00
Asim Aslam
87b56d46ac Use tunnel transport and set server address 2019-08-27 13:21:36 +01:00
Milos Gajdos
371b23d055
Introduce DefaultLink; dont hardcode name of the link 2019-08-27 11:36:46 +01:00
Asim Aslam
f97565ef0a
Merge pull request #685 from milosgajdos83/default-network
Default network implementation
2019-08-27 11:02:55 +01:00
Milos Gajdos
ed8d28c9ab
Set Route.Link to "network" not Route.Network. Oops! 2019-08-23 21:08:18 +01:00
Milos Gajdos
88e47b9b06
Dont bail when unable to resolve network nodes. 2019-08-23 17:48:14 +01:00
Asim Aslam
1b0295de0d Add a static network node resolver 2019-08-23 17:24:21 +01:00