Commit Graph

388 Commits

Author SHA1 Message Date
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
Milos Gajdos
9448d7c164
Set Route.Network to "network" and Router.Gateway to network.Address 2019-08-23 16:01:57 +01:00
Milos Gajdos
8c3eec9f2a
Set the default resolver to registry 2019-08-23 15:14:16 +01:00
Milos Gajdos
e53484302c
Added ControlChannel tunnel.Listener to process incoming messages 2019-08-23 15:14:16 +01:00
Milos Gajdos
db89fc4efe
Set server name to the correct value. 2019-08-23 15:14:16 +01:00
Milos Gajdos
e1599b0f17
Set server name. Set default network name. 2019-08-23 15:14:16 +01:00
Milos Gajdos
a09d5d2e9a
Add Address method. Start and Stop router/server. 2019-08-23 15:14:16 +01:00
Milos Gajdos
6c1f1d66f7
Switch received messages on the right header 2019-08-23 15:14:16 +01:00
Milos Gajdos
a6e1287b27
Replaced incorrect proto import path 2019-08-23 15:14:15 +01:00
Milos Gajdos
fcec6e8eae
First attempt to implement default network interface 2019-08-23 15:14:15 +01:00
Milos Gajdos
6beae23afd
First commit. Outline of the default network. 2019-08-23 15:14:15 +01:00
Asim Aslam
34381213e7 Package comment 2019-08-05 18:04:47 +01:00
Asim Aslam
4030ccc27b Move proxy/router 2019-08-05 17:44:33 +01:00
Asim Aslam
d250ac736f In the event watchRegistry or watchTable exit then close the go routines 2019-08-02 15:17:48 +01:00
Asim Aslam
6719f8d655 Remove the table watcher when stopped 2019-08-02 14:59:08 +01:00
Asim Aslam
d7929ef8f3 Stop the ticker when exiting 2019-08-02 14:44:11 +01:00
Milos Gajdos
2720c6f28e
Removed trailing white characters 2019-08-01 13:32:55 +01:00
Asim Aslam
cdf0f14d58 remove this code 2019-07-31 17:19:49 +01:00
Asim Aslam
679c5f0ccd Fix some connection bugs 2019-07-31 16:49:48 +01:00
Asim Aslam
873bfcc73c Process/Stop router 2019-07-31 16:46:55 +01:00
Asim Aslam
7884e889f4 Don't publish the process rpc call and embed the router handler in the network 2019-07-31 16:36:53 +01:00
Asim Aslam
b1c49a0ddc Add router handler 2019-07-31 16:10:04 +01:00
Asim Aslam
318367cd71 move NewNetwork 2019-07-31 15:37:12 +01:00
Asim Aslam
2d09e74b0e add address/advertise 2019-07-31 15:35:51 +01:00
Asim Aslam
3e90d32f29 Add proxy/router 2019-07-31 15:30:51 +01:00
Asim Aslam
fca89e06ef Some network inspiration 2019-07-31 15:22:57 +01:00
Asim Aslam
852abcaaed yolo commit functioning router code. all credit to the milos gajdos 2019-07-29 18:57:40 +01:00
Asim Aslam
11f80708ce move lock 2019-07-29 12:52:52 +01:00
Asim Aslam
104778e5e5 move lock 2019-07-29 12:52:32 +01:00
Asim Aslam
ae99b9a887 syntactic changes 2019-07-29 12:44:59 +01:00
Asim Aslam
8fdc050e2e syntactic changes 2019-07-29 12:44:28 +01:00
Asim Aslam
8855beb62d syntactic changes 2019-07-29 12:43:20 +01:00
Asim Aslam
47acdf6a4b move Table to table 2019-07-29 12:40:13 +01:00
Asim Aslam
4fc9b9821a
Merge pull request #621 from milosgajdos83/no-table-package
[WIP] No table package. router/service package introduced
2019-07-29 12:36:40 +01:00
Asim Aslam
5b327ce723 change id to name in resolver 2019-07-28 20:00:09 +01:00
Asim Aslam
adb6760e21 readd the resolver 2019-07-28 12:14:40 +01:00
Milos Gajdos
3d2ec5dbb1
Regenerated proto because proto reasons. 2019-07-27 16:12:44 +01:00
Milos Gajdos
96f9ce1bd3
Proper router stopping. Printable router status. 2019-07-27 16:11:06 +01:00
Milos Gajdos
cb3052ce04
Proper stopping of service router 2019-07-27 16:11:06 +01:00
Milos Gajdos
2f1658c213
Table package is no more, hence removed references to it 2019-07-27 16:11:06 +01:00
Milos Gajdos
d8b00e801d
Stop watcher when router stops. Drain advert channel when stopping. 2019-07-27 16:11:06 +01:00
Milos Gajdos
002abca61f
Finished Advertise(). Implemented Process() 2019-07-27 16:11:06 +01:00
Milos Gajdos
c5740ae031
Outline of Advertise, Watch and start of the router. 2019-07-27 16:11:05 +01:00
Milos Gajdos
ddad43bd77
Added service.Router Route CRUD. Outlined watcher and run() 2019-07-27 16:11:05 +01:00
Milos Gajdos
b6fb969ab9
Add List and Lookup implementation. Default error for not implement. 2019-07-27 16:11:05 +01:00
Milos Gajdos
22d0f1f08f
Changed documentation. 2019-07-27 16:08:14 +01:00
Milos Gajdos
c3a8146d99
Added outline of router/service package. 2019-07-27 16:08:14 +01:00
Milos Gajdos
2338780a61
Full router RPC coverage 2019-07-27 16:08:14 +01:00
Milos Gajdos
e22c4b4c07
table package is no more. Cleaned up unnecessary code, too. 2019-07-27 16:04:08 +01:00
Asim Aslam
4e27aac398 regen router proto 2019-07-26 18:07:36 -07:00
Asim Aslam
7ca06f0c1d set router proto package name to go.micro.router 2019-07-26 18:07:14 -07:00
Milos Gajdos
9ad5ae6644
Adds new RPC methods to router service interface
We have added Advertise() and Process() RPCs in this commit.
2019-07-24 21:07:04 +01:00
Milos Gajdos
809de7a052
Mutex Unlock when we fail to store route in cache. 2019-07-24 19:13:05 +01:00
Milos Gajdos
23f0231a09
Adds route watcher to mucp.Proxy 2019-07-24 19:03:13 +01:00
Milos Gajdos
b55adc0c30
mucp Proxy no longer uses RPC interface of router.Router directly 2019-07-24 18:32:39 +01:00
Milos Gajdos
13a8cfe7f3
Small function documentation update 2019-07-24 17:22:27 +01:00
Milos Gajdos
1e94d9fe5a
Router cleanup and refactoring for win and profit.
This commit adds the following changes to router package:
* it refactors Advertise() function which now does only what
it claims to do: advertising
* various router packages functions/methods have been renamed to make
their functionality more obvious and more in line with what they actually do
* function documentation changes related to the above bullet points
2019-07-24 17:16:52 +01:00
Milos Gajdos
94b6455577
Increment WaitGroup before launching advertiseEvents goroutine 2019-07-17 13:02:47 +01:00
Milos Gajdos
2803146673
Renaming rampage
Addressing the comments in #591, router.String() now returns "default"

Furthermore, a tonne of other renaming has been included in this commit
as a result of running go vet ./... inside the router package.
2019-07-17 00:06:11 +01:00
Milos Gajdos
92495d22db
Fixes advert dampening behaviour.
This commit adds the following changes:
* advert now stores a list of route events as opposed to just last one
* attempt to dedup route events before appending them to advert
* have max suppress threshold for long time suppressed adverts
* decaying events on every advert tick

Originally we werent decaying penalties on every advert tick.
That was incorrect behaviour. Furthermore some events would end up being
accumulated potentially causing memory leaks.

We were also overriding the last received router event which was causing
incorrect sequence of events to be applied when received by a receiver:
Create, Delete would be "squashed" into Delete only which would be
nonsensical since the Create event would never be delivered hence we
would be deleting nonexistent routes.

Not Decaying the events on every tick or not having the max suppression
threshold could lead to DoS by growing the router memory infinitely.
2019-07-16 19:00:25 +01:00
Asim Aslam
aa79c41fc5 update tunnel comment 2019-07-14 18:34:32 -07:00
Asim Aslam
5157241c88 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-11 21:46:33 +01:00
Asim Aslam
70d811c47a don't use quic in the test 2019-07-11 21:46:27 +01:00
Milos Gajdos
9c851f297b
Added proto.Advert type to protobuf definitions 2019-07-11 21:14:34 +01:00
Milos Gajdos
35a1de91a9
Advertise full table every minute. 2019-07-11 12:39:20 +01:00
Asim Aslam
6581586226 Make tunnel test use quic 2019-07-11 10:34:01 +01:00
Asim Aslam
9b1cb4ef0e functioning tunnel with test 2019-07-11 00:55:50 +01:00
Asim Aslam
ae5376cc0e functioning tunnel/link code 2019-07-11 00:14:36 +01:00
Milos Gajdos
a0ee7d2092
Added update action to manageServiceRoutes. Table is embedded; skip opts 2019-07-10 21:28:32 +01:00
Asim Aslam
998a23c963 Functional code for link 2019-07-10 20:04:01 +01:00
Asim Aslam
e17ecf66b1 Fix breaking code 2019-07-10 20:03:55 +01:00
Asim Aslam
7c29be288b Update a tunnel top level comment 2019-07-10 19:33:34 +01:00
Asim Aslam
217f540601 The listener has no session id 2019-07-10 19:17:36 +01:00
Asim Aslam
ffae0f0fab Add a comment for tunnel processor 2019-07-10 19:13:50 +01:00
Asim Aslam
4cca2b43a3 Add further link comments 2019-07-10 19:11:32 +01:00
Asim Aslam
8c157c1d5f update link comments 2019-07-10 19:09:22 +01:00
Asim Aslam
1f218f7b48 Allow the socket to be specified 2019-07-10 19:07:18 +01:00
Asim Aslam
7e0d4fe0cf Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-10 19:01:38 +01:00
Asim Aslam
0a39fe39c3 Update tunnel to use id+session for the key 2019-07-10 19:01:24 +01:00
Milos Gajdos
163b917ec7
proto.EventType Insert is now Create to mirror table.Event 2019-07-10 18:37:46 +01:00
Asim Aslam
0f16eb2858 add further comments to tunnel 2019-07-10 18:35:10 +01:00
Asim Aslam
89231f701b Add comments and session 2019-07-10 18:26:11 +01:00
Asim Aslam
196e76e350 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-10 18:24:12 +01:00
Asim Aslam
f3d9177233 Add sessions to tunnel 2019-07-10 18:24:03 +01:00
Asim Aslam
8b7ac8a3f9
Merge pull request #576 from milosgajdos83/router-rpc
Added List and Watch rpc calls.
2019-07-10 17:55:23 +01:00
Milos Gajdos
8f5aed707e
Table.Add is now Table.Create. Insesrt event is now Create event. 2019-07-10 17:46:22 +01:00
Asim Aslam
c71576a538 Update link Id comment 2019-07-10 17:43:36 +01:00
Asim Aslam
27cfc06828 Cleanup and move around the link code 2019-07-10 17:42:41 +01:00
Asim Aslam
717ba4b3c0 Add tunnel comments 2019-07-10 17:41:17 +01:00
Asim Aslam
4e3a230356 top level package comment 2019-07-10 17:40:14 +01:00
Asim Aslam
66c2519696 Add Tunnel: an interface for stream duplexing over a link 2019-07-10 17:36:04 +01:00
Milos Gajdos
86dfa82dfa
Added List and Watch rpc calls. 2019-07-10 17:21:55 +01:00
Asim Aslam
55f8045a70 Add link: a layer ontop of a transport socket 2019-07-10 17:12:51 +01:00
Asim Aslam
b23d955536 Use gateway if available 2019-07-10 08:26:33 +01:00
Asim Aslam
5b565f9f10 update comment 2019-07-10 07:56:52 +01:00
Asim Aslam
9955ed2034 move table 2019-07-10 07:56:18 +01:00
Asim Aslam
c36107e811 cleanup consts 2019-07-10 07:51:24 +01:00
Asim Aslam
a08b64c8ab remove the string methods 2019-07-10 07:50:33 +01:00
Asim Aslam
64ec0633a3 Fix breaks and go fmt 2019-07-10 07:47:17 +01:00
Asim Aslam
0a1b657221 visual cleanup of router code 2019-07-10 07:45:27 +01:00
Asim Aslam
34967e8e33
Merge pull request #573 from milosgajdos83/flap-detection
Router rework. Flap detection. Table package.
2019-07-10 07:12:18 +01:00
Asim Aslam
eda380284c remove network 2019-07-09 18:45:14 +01:00
Asim Aslam
0bf54c122f move transport back 2019-07-09 18:41:26 +01:00
Asim Aslam
97282a5377 remove resolver 2019-07-09 16:54:44 +01:00
Asim Aslam
b642d5e1c0 remove proto dir 2019-07-09 16:53:30 +01:00
Asim Aslam
c5a282ddd3 remove the tunnel 2019-07-09 16:52:44 +01:00
Milos Gajdos
6cf8bde612
Router selector and proxy modifications due to Route struct changes. 2019-07-09 16:45:31 +01:00
Asim Aslam
327029beff fix string method 2019-07-09 16:44:43 +01:00
Asim Aslam
c5214c931f reorder and reword 2019-07-09 16:38:44 +01:00
Asim Aslam
d725980444 add some initialisers 2019-07-09 16:37:59 +01:00
Milos Gajdos
23cb811f60
Removed fmt.Stringer artistry from all roouter and table structs 2019-07-09 16:17:18 +01:00
Milos Gajdos
c5fb409760
Removed debug logs 2019-07-09 15:55:39 +01:00
Milos Gajdos
70665e5a7d
Route has changed to accomodate Link, Service and Address 2019-07-09 15:46:32 +01:00
Milos Gajdos
449aa0a339
Collect ANNOUNCE mesage events before adding default gateway. 2019-07-09 15:46:31 +01:00
Milos Gajdos
265271008e
Simplified processEvents loop; Added router Announcement. 2019-07-09 15:46:31 +01:00
Milos Gajdos
b82245429e
Simplified table logic. Lookup tests. mucp/cient update 2019-07-09 15:46:31 +01:00
Milos Gajdos
cc590f5f2c
Table now has a dedicated package inside router package. 2019-07-09 15:46:31 +01:00
Milos Gajdos
0c1a28a9b6
Router routing table management. Table route hashes. Status codes changed.
We now manage routing table actions using dedicated functions run on
either registry or services in the registry.

Routing table now uses Route.Hash() instead of maintaining its own hash
struct filed which previously performed these operations.

Various names of variables have been changed to make them more concise.
2019-07-09 15:46:31 +01:00
Milos Gajdos
30d05e34a9
Read and remove routes based on registry event deltas 2019-07-09 15:46:31 +01:00
Milos Gajdos
b68f0e237f
Removed event from eventMap once sent to be advertised 2019-07-09 15:46:31 +01:00
Milos Gajdos
72ef032162
First shot at flapping detection and event advertising.
This commit also adds Route hash function, lots of debug messages for
now and String() methods for various API objects.
2019-07-09 15:46:30 +01:00
Milos Gajdos
d6c07dfb16
Update is now Advert 2019-07-09 15:46:30 +01:00
Milos Gajdos
ea872f6900
Updated error statements; Update ships list of events. 2019-07-09 15:46:30 +01:00
Asim Aslam
6bdc23a3aa add comments 2019-07-08 16:32:12 +01:00
Asim Aslam
fa54db5ba5 rename network name to go.micro 2019-07-08 16:27:02 +01:00
Asim Aslam
608a1f8add remove node code 2019-07-08 16:25:04 +01:00
Asim Aslam
4a02e1ff2f rewrite network interface 2019-07-08 16:24:57 +01:00
Asim Aslam
e0bf1c2283 Remove Port from registry 2019-07-08 08:01:42 +01:00
Asim Aslam
5b7454e5a8 update transport package comments 2019-07-07 15:04:07 +01:00
Asim Aslam
0b732b2c49 update transport package comments 2019-07-07 15:03:08 +01:00
Asim Aslam
777a203f96 gofmt 2019-07-07 12:33:54 +01:00
Asim Aslam
5f664faeba Add transport options comments 2019-07-07 12:23:03 +01:00
Asim Aslam
d2d6841f02 Move transport to network/transport 2019-07-07 10:37:34 +01:00
Asim Aslam
eafc930f84 Change network id to name 2019-07-07 10:10:38 +01:00
Asim Aslam
00ba1655ca remove some readmes 2019-07-04 11:15:54 +01:00
Asim Aslam
2644497ccb Fix some link connection logic 2019-07-03 19:51:40 +01:00
Asim Aslam
e54de56376 Functional loopback code 2019-07-03 19:26:24 +01:00
Asim Aslam
7008809eff Make the link use debug 2019-07-02 20:57:23 +01:00
Asim Aslam
f619e46def Some functioning network code 2019-07-02 20:54:21 +01:00
Asim Aslam
543dc0166c Restructure network things before moving 2019-07-02 08:45:00 +01:00
Milos Gajdos
0e1fcc4f28
Stop hardcoding table sizes; increment as you move on. 2019-07-01 23:38:49 +01:00
Milos Gajdos
8f22e61a8b
List test function properly named. 2019-07-01 23:38:48 +01:00
Milos Gajdos
956902f641
Added List tests. 2019-07-01 23:38:48 +01:00
Milos Gajdos
ffac0b9a18
First batch of Add/Del/Update tests. 2019-07-01 23:38:48 +01:00
Asim Aslam
c108b51d2a add network to Node proto 2019-07-01 23:12:05 +01:00
Asim Aslam
5fd798c9b6 add resolver comment 2019-07-01 23:11:55 +01:00
Asim Aslam
ebe3633082 move network initialiser code 2019-07-01 22:59:11 +01:00
Asim Aslam
032c3134c6 update comment 2019-07-01 22:54:26 +01:00
Asim Aslam
8ccf61ebaf Strip Link methods 2019-07-01 22:52:28 +01:00
Asim Aslam
fbbc33d0f9 Set Network() to string 2019-07-01 22:41:27 +01:00
Milos Gajdos
da299ea26b
Simmplified RT Lookup. No more Metric in Query. 2019-07-01 20:33:08 +01:00
Asim Aslam
d3e200575c Merge branch 'master' of ssh://github.com/micro/go-micro 2019-07-01 18:37:45 +01:00
Asim Aslam
ddee8412ff Add tunnel interface 2019-07-01 18:37:39 +01:00
Milos Gajdos
f6e064cdbd
Fixed router idempotency. Return registry.ErrWatchStopped from mdns reg 2019-07-01 15:46:26 +01:00
Milos Gajdos
cff46c3fd8
Added Init state. Recreate exit and advertise channels when recovering
In order to differentiate between intialized and other states we
introduced a new state: Init. The router is in this state only when it's
created.

We have cleaned up router status management which is now handled by
manageStatus function only.
2019-07-01 15:46:26 +01:00
Milos Gajdos
32300eadc1
Added Router Status which allows to track router status 2019-07-01 15:46:25 +01:00
Milos Gajdos
8ad2f73ad6
Advertisement is now Update; started bit is now running. 2019-07-01 15:46:25 +01:00
Milos Gajdos
9d7420658d
Changed router interface. Added table watcher. Advertise routes
* Changed router interface to return Advertisement channel
* Added default gateway route to the routing table if supplied
* Watch table for updates and advertise to the network
* We hash the routes on 3-tuple (Destination, Gateway, Network)
2019-07-01 15:46:25 +01:00
Asim Aslam
0899282277 Checkpoint networking code 2019-07-01 11:55:15 +01:00
Asim Aslam
b4b76d452a Call advertise 2019-06-27 14:38:12 +01:00
Asim Aslam
67e3d560fe Lookup every service. FML 2019-06-27 14:37:52 +01:00
Asim Aslam
9630e153a5 fix grpc proto wrapper 2019-06-27 13:08:06 +01:00
Asim Aslam
43297f731c Add default router 2019-06-27 12:57:23 +01:00
Asim Aslam
f6f6e1b561 Use the router to get routes 2019-06-27 12:56:52 +01:00
Asim Aslam
b904f383c1 go fmt 2019-06-26 19:28:30 +01:00
Milos Gajdos
76011b151d
Bugfix: Set gateway to node.Address
gw has not been initialized; it was basically an empty string and only
got populated by Sprintf-ing the addr:port IF the port has been set.
This commit sets the gw to node.Address to it's never an empty string.
2019-06-26 16:28:33 +01:00
Asim Aslam
27b145f968 add router proto 2019-06-26 16:23:10 +01:00
Asim Aslam
ac098e4d78 add router selector and network defaults 2019-06-26 16:12:57 +01:00
Milos Gajdos
fe84a2d726
Route per service node. No Network Registry for now. 2019-06-26 16:03:19 +01:00
Asim Aslam
68764ebafc Add registry resolver 2019-06-24 15:30:17 +01:00
Asim Aslam
4d08618517 fix typo 2019-06-24 15:22:12 +01:00
Asim Aslam
e5959f80d6 add http resolver 2019-06-24 15:21:24 +01:00
Asim Aslam
b89423bf37 add resolver 2019-06-24 15:11:11 +01:00
Asim Aslam
dffbe045e4 move node functions 2019-06-22 19:02:57 +01:00
Asim Aslam
2d91ba411e update the network interface 2019-06-22 16:51:20 +01:00
Asim Aslam
3f97743e34 Move router and proxy into network package 2019-06-21 17:20:31 +01:00
Asim Aslam
ed54384bf4 Update network 2019-06-18 11:56:11 +01:00
Asim Aslam
59eaa89bac Node is a network 2019-06-17 21:11:39 +01:00
Asim Aslam
1a571b8c82 Add network transport 2019-06-17 18:25:42 +01:00
Asim Aslam
308673b393 add network package 2019-06-17 16:57:53 +01:00