Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph Merge #2024

Open
wants to merge 78 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
fb4cf14
Making a change to the text to tes
ZiYue01 Feb 21, 2024
c972b48
Added Graph tab to Nexodus homepage
Adilling3654 Feb 25, 2024
dbb1e5c
Use 1GB memory for postgres database instance
russellb Feb 26, 2024
14fcb34
UI things
mamastor Feb 27, 2024
83a303a
Merge branch 'nexodus-io:main' into main
mamastor Feb 27, 2024
88eecbc
Merge branch 'nexodus-io:main' into main
BrandonTrapp88 Feb 28, 2024
9c22a1d
Updated dependencies for testing
Adilling3654 Mar 3, 2024
5996ff0
Add the path to the graph tab as a custom route rather than a resourc…
Adilling3654 Mar 4, 2024
47912a2
getRemap
Mar 10, 2024
4adb1ab
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Mar 10, 2024
8c2f6de
Added device and relay nodes to Dashboard.tsx to use for Graph.tsx.
Mar 12, 2024
3a12eb5
apiChanges
Mar 13, 2024
f099441
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Mar 13, 2024
f2ac106
Added another test graph using ReactFlow
Adilling3654 Mar 16, 2024
d06e065
database and status handler
mamastor Mar 16, 2024
16070c6
more database and status handler
mamastor Mar 16, 2024
d349475
migration
Mar 17, 2024
758bb28
migration
Mar 17, 2024
bb884dc
updateStatus
Mar 18, 2024
543f826
updateStatus
Mar 19, 2024
39b1429
Updated node designs and added two additional columns in the table.
Mar 19, 2024
29488d3
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Mar 19, 2024
453e681
Merge remote-tracking branch 'upstream/main'
mamastor Mar 20, 2024
a46ff0a
Status_test
Mar 20, 2024
301c0d4
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Mar 20, 2024
030bf78
statusUpdate
Mar 20, 2024
6c8696e
new api changes
Mar 20, 2024
3e7ba9b
getStatus Commit
Mar 21, 2024
1b182d1
Added ConnectivityProbe function be called every 5-seconds
Adilling3654 Mar 22, 2024
b098c5d
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Adilling3654 Mar 22, 2024
e11e937
Added probeConnectivity to 5-second timer
Adilling3654 Mar 22, 2024
5705e3a
new Api commits
Mar 23, 2024
955219f
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Mar 23, 2024
d6e04dd
api changes
Mar 23, 2024
74f6212
ReactFlow component changes
Adilling3654 Mar 25, 2024
dde4822
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Adilling3654 Mar 25, 2024
7bcb80c
Added back Graph tab
Adilling3654 Mar 25, 2024
37da4f4
post method
mamastor Mar 26, 2024
28ca89b
post methods
mamastor Mar 26, 2024
d27293a
Merge pull request #1 from BrandonTrapp88/post_statuses
mamastor Mar 26, 2024
278a43d
Added device and relay icons and separators to nodes.
Mar 26, 2024
38b053b
Updated device nodes
Adilling3654 Mar 26, 2024
d191e1f
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Adilling3654 Mar 26, 2024
9ad4884
add status
mamastor Mar 26, 2024
fd8e3a7
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
mamastor Mar 26, 2024
eab4243
Added device and relay icons and separator to nodes.
ZiYue01 Mar 26, 2024
02c55c4
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
ZiYue01 Mar 26, 2024
9b28d01
Improved node design & added relay node
Adilling3654 Mar 29, 2024
461a86b
updated token
Mar 29, 2024
8a2d851
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Mar 29, 2024
8a2737b
Testing get method
mamastor Apr 1, 2024
e19457b
Update status.go
mamastor Apr 1, 2024
610c813
Merge pull request #2 from BrandonTrapp88/get_test
mamastor Apr 1, 2024
c4a94fc
Documentation
mamastor Apr 1, 2024
d0180eb
documentation
mamastor Apr 1, 2024
5ed14ec
documentation
mamastor Apr 1, 2024
bdc43f2
documentation
mamastor Apr 1, 2024
30b4ec1
Merge pull request #3 from BrandonTrapp88/documentation
mamastor Apr 1, 2024
0490cac
deleteStatusesOperation added
Apr 8, 2024
4f2d439
Removed uneeded scripts,added comments for Graph code & method to con…
Adilling3654 Apr 8, 2024
0688357
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Adilling3654 Apr 8, 2024
2e6ddf9
deleteStatus error fix
Apr 10, 2024
d263409
FetchStatus
mamastor Apr 11, 2024
c87c964
nodes connect to central node
Apr 11, 2024
dfeeea9
Added test for relay node connections
Adilling3654 Apr 11, 2024
522a08b
moveable nodes
Apr 12, 2024
71cbff1
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Apr 12, 2024
a549632
Added code to change device node border color depending on latency
ZiYue01 Apr 14, 2024
4199b09
fetch timer
mamastor Apr 15, 2024
47818d4
docs update
mamastor Apr 16, 2024
3606160
update docs
mamastor Apr 16, 2024
79b5812
more mistakes
mamastor Apr 16, 2024
e3d1c5e
Updated latency numbers
ZiYue01 Apr 18, 2024
13f1425
Relay node now shows relevant info + latency
Adilling3654 Apr 18, 2024
77fbdf0
Merge branch 'main' of https://github.com/BrandonTrapp88/nexodusProject
Adilling3654 Apr 18, 2024
69c5b4d
merge adjustments
Adilling3654 Apr 18, 2024
a667d2e
Merge remote-tracking branch 'upstream/main'
Apr 23, 2024
1bdc080
status update
Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ docs/user-guide/nexctl.md: dist/nexctl hack/nexctl-docs.sh
$(ECHO_PREFIX) printf " %-12s nexctl\n" "[DOCS]"
$(CMD_PREFIX) hack/nexctl-docs.sh

dist/.generate: $(SWAGGER_YAML) $(PRIVATE_SWAGGER_YAML) dist/.ui-fmt docs/user-guide/nexd.md docs/user-guide/nexctl.md | dist
dist/.generate: $(SWAGGER_YAML) $(PRIVATE_SWAGGER_YAML) docs/user-guide/nexd.md docs/user-guide/nexctl.md | dist
$(ECHO_PREFIX) printf " %-12s \n" "[MOD TIDY]"
$(CMD_PREFIX) go mod tidy

Expand Down
75 changes: 75 additions & 0 deletions docs/development/design/status-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Design Document: Status API

## Introduction

The goal of this design document is to outline the purpose and implementation of the status API.

## The Problem

There is a visual disconnect for a user's Nexodus network of devices.

## The Solution

With the addition of an API endpoint, device statuses can be created and stored. The status of devices in a user's Nexodus network can then be visualized in a web interface. The network will be displayed as a graph.

## Implementation

A general view of a device's connectivity includes:

1. Devices a source device is attempting to directly connect to
2. Is the device connected to a relay and which devices is it using the relay to connect to
3. Which devices can it reach successfully
4. The latency of the source to each device in the network

The proposed API additions are as follows:

```go
// Create new statuses
private.POST("/status", api.CreateStatus)
// List all satuses for a user's devices
private.GET("/status", api.ListStatuses)
// Updates a device status if a status already exists
private.PUT("/status", api.UpdateStatus)
```

## New Tables

A new table will be defined for device statuses.

### Status Model

- New models

```go
// Status represents the status of single user device
type Status struct {
Base
UserId uuid.UUID `json:"user_id"`
WgIP string `json:"wg_ip"`
IsReachable bool `json:"is_reachable"`
Hostname string `json:"hostname"`
Latency string `json:"latency"`
Method string `json:"method"`
}

// AddStatus is the information necessary to add a device status
type AddStatus struct {
WgIP string `json:"wg_ip"`
IsReachable bool `json:"is_reachable"`
Hostname string `json:"hostname"`
Latency string `json:"latency"`
Method string `json:"method"`
}

// UpdateStatus is the information needed to update a device status that already exists
type UpdateStatus struct{
WgIP string `json:"wg_ip"`
IsReachable bool `json:"is_reachable"`
Latency string `json:"latency"`
Method string `json:"method"`
}
```

### The Graph Display

React Flow library was chosen for its flexibility and support for customization. The custom nodes were created with a set of criteria in mind including the shape of the node, the border color based on latency, icons for the connection status, and what information to include in the table when the node is clicked on. The device nodes are rectangular in shape, while the relay nodes are oval shaped. The border color will display green if the latency is in the range of 0 to 40 milliseconds, gold/orange if the latency is between 41 to 80 milliseconds, and red if the latency is 81 milliseconds or higher. If a device or relay is reachable, then a green check mark icon will appear on the right side of the node. If a device or relay becomes unreachable, then a red X icon will appear instead. The graph organizes itself show devices connected directly to the host device and those connected to a relay. The nodes are draggable for better organization based on user preferences. The data is fetched every 3 minutes and the information in the nodes is updated.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nexodus-io/nexodus

go 1.22
go 1.22.0

require (
github.com/Nerzal/gocloak/v13 v13.9.0
Expand Down Expand Up @@ -60,10 +60,10 @@ require (
go.opentelemetry.io/otel/trace v1.22.0
go.uber.org/zap v1.26.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/net v0.23.0
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.17.0
golang.org/x/sys v0.18.0
golang.org/x/term v0.18.0
golang.org/x/sys v0.17.0
golang.org/x/term v0.17.0
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230215201556-9c5414ab4bde
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,11 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ=
golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA=
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
4 changes: 4 additions & 0 deletions internal/client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ api_reg_key.go
api_security_group.go
api_service_network.go
api_sites.go
api_status.go
api_statuses.go
api_users.go
api_vpc.go
client.go
Expand All @@ -20,6 +22,7 @@ model_models_add_reg_key.go
model_models_add_security_group.go
model_models_add_service_network.go
model_models_add_site.go
model_models_add_status.go
model_models_add_vpc.go
model_models_base_error.go
model_models_certificate_signing_request.go
Expand All @@ -39,6 +42,7 @@ model_models_security_group.go
model_models_security_rule.go
model_models_service_network.go
model_models_site.go
model_models_status.go
model_models_tunnel_ip.go
model_models_update_device.go
model_models_update_reg_key.go
Expand Down
185 changes: 185 additions & 0 deletions internal/client/api_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading