Commit graph

154 commits

Author SHA1 Message Date
Christian Ditaputratama
f2cc795dc2
feat: Added protocol cell to remote nodes table 2024-11-01 19:50:56 +07:00
Christian Ditaputratama
b23b0ae31a
feat: Added hostname:port cell to remote node table
TODO: Add modal window for tor addresses
2024-11-01 04:13:52 +07:00
Christian Ditaputratama
751bfbc585
feat: Added nettype cell table 2024-11-01 03:05:29 +07:00
Christian Ditaputratama
6efa763e73
style: Styling base datatable CSS 2024-10-31 23:08:05 +07:00
Christian Ditaputratama
10182d9dbc
feat!: Added base datatable functionality
Deprecated: `SortDirection` is deprecated, use `SortDir` instead
2024-10-31 22:45:26 +07:00
Christian Ditaputratama
ca3ca881fd
feat: Added paging package
Helper package for datatable pagination
2024-10-31 22:44:20 +07:00
Christian Ditaputratama
ec6f0a1893
Changed LastChecked from uint to int64
Since the LastChecked record is storing unix timestamp, using `int64`
make it easier to work with `time` package.
2024-10-31 22:40:38 +07:00
Christian Ditaputratama
30aa8d80dc
feat: Added favicon 2024-10-31 18:55:31 +07:00
Christian Ditaputratama
f6adb40b3f
chore: Open GitHub repo in the new tab 2024-10-31 18:20:53 +07:00
Christian Ditaputratama
93fb22f29b
feat: Added clipboard functionality 2024-10-31 18:09:02 +07:00
Christian Ditaputratama
63e803ba17
style: Added remote-nodes and add-node page design 2024-10-31 16:28:51 +07:00
Christian Ditaputratama
ddc837be4a
style: Changed sticky navbar to fixed position 2024-10-31 16:26:49 +07:00
Christian Ditaputratama
4dfab11d2c
feat(style)!: Added the new homepage design view
TODO: Add copy to clipboard functionality
2024-10-31 16:25:16 +07:00
Christian Ditaputratama
0a80a52d2d
chore: Moving Monero QR donation image location 2024-10-31 16:21:43 +07:00
Christian Ditaputratama
176a02412a
Switching to BSD-3-Clause license
I've been suggested to change the license to more popular open-source
licenses. So I choose to change from GLWTPL to BSD-3-Clause.
2024-10-31 10:59:08 +07:00
Christian Ditaputratama
8b39502d90
chore(style): Changed UI layout styles 2024-10-31 10:39:18 +07:00
Christian Ditaputratama
965d3230a1
feat: Added navbar current page position indicator 2024-10-30 15:39:01 +07:00
Christian Ditaputratama
dd48bd458a
feat: Added global loading indicator 2024-10-30 15:10:35 +07:00
Christian Ditaputratama
2003c3c3ac
feat(ui): Added main navbar 2024-10-30 14:23:45 +07:00
Christian Ditaputratama
3a45071cd6
feat: Refactor fiber server 2024-10-29 21:30:04 +07:00
Christian Ditaputratama
be32011cfa
feat!: templ + htmx build system 2024-10-29 20:41:22 +07:00
Christian Ditaputratama
ef953b36fd
fix: Reject input hostname with protocol
This is quick fix.

Do not accept submitted tor address with protocol since it won't work.

The initial clearnet validation can be done with `net.LookupIP`, but
for tor network can't be done with that method. For now, just inform
to remove the http:// or https:// part to the submitter.
2024-09-16 22:35:14 +07:00
Christian Ditaputratama
9bd609e4dd
chore: Remove dev SQL statement 2024-09-12 05:27:54 +07:00
Christian Ditaputratama
f6b048b017
feat: Record node ip addresses #84
For future use investigations about "suspicious" nodes. #105
2024-09-12 01:13:30 +07:00
Christian Ditaputratama
c3f837e122
feat: Check IP-stack info everytime prober send report #84
This commit add IsIPv6Only function inside `internal/ip` package
and moving `geo` package from `internal/geo` to `internal/ip/geo`.

Although it increases server resource usage, checking hostname to IP is
required every time the prober sends a report so that the `ipv6_only`
record in the database is not up-to-date. Previously, this feature did
not exist.
2024-09-09 18:21:03 +07:00
Christian Ditaputratama
518d4b4335
feat: Added IPv6 nodes support (alpha) #84
This commit accept IPv6 nodes submission.

When user submit new public node, the server will check IP addresses
from given hostname. If host IP addresses doesn't have IPv4, it will
be recorded as "IPv6 only" node.

Probers that support IPv6 may add `IPV6_CAPABLE=true` to the `.env`
file.

Please note that this feature still experimental and may not being
merged to the main branch.
2024-09-06 00:08:59 +07:00
Christian Ditaputratama
5a6641a199
refactor: Use ptr for QueryNodes.toSQL()
Since `SortBy` and `SortDirection` is modified directly from `QueryNodes`
pointer, `sortBy` and `sortDirrection` return value from `QueryNodes.toSQL()`
no longger needed
2024-08-05 18:27:00 +07:00
Christian Ditaputratama
4395a5e2d5
test: Add benchmark Test for QueryNodes.toSQL()
Some checks are pending
Build / build (push) Waiting to run
Test / test (push) Waiting to run
2024-07-29 22:44:10 +07:00
Christian Ditaputratama
97fad6cacb
refactor: Use slice.Contains() nettype check
Instead using `||` for each nettype query check , simply using `slice.Contains`.
Also, checking `any` value is not needed here.
2024-07-29 22:30:03 +07:00
Christian Ditaputratama
73308d2a32
refactor: Use proberRepo struct instead of interface
Some checks failed
Build / build (push) Has been cancelled
Test / test (push) Has been cancelled
o need to use interface when calling `NewProber()`.
2024-07-07 03:25:30 +07:00
Christian Ditaputratama
4d1a2da49c
refactor: Use moneroRepo struct instead of interface
No need to use interface when calling `monero.New()`.
2024-07-07 03:13:11 +07:00
Christian Ditaputratama
ef553dab9e
refactor: Use cronRepo struct instead of interface
No need to use interface when calling `cron.New()`.
2024-07-07 02:57:36 +07:00
Christian Ditaputratama
c250e8e3bb
feat!: Moving handler to internal/handler
So people aware that the package is internal use and not using that
on their projects.
2024-07-07 01:42:29 +07:00
Christian Ditaputratama
4c7d53547b
feat!: Change the module name to "URL based"
This make me easier to test the module with external services.
2024-07-07 01:28:44 +07:00
Christian Ditaputratama
0d72dd9995
build: Inject version when build the binaries
The version include git current commit and branch info.
2024-07-04 03:45:37 +07:00
ditatompel
3f5c0c9472
refactor: Lowercase & upperase initialism acronyms 2024-06-19 16:24:18 +07:00
ditatompel
e9cacb478c
feat: Allow user to specify custom .env location
Some checks failed
Build / build (push) Has been cancelled
Test / lint (push) Has been cancelled
This feature can also be useful for running tests in CI.
2024-06-18 04:23:08 +07:00
ditatompel
17b5f18332
chore(docs): Note how to get list of public nodes
Adding example way to get list of Monero public nodes
using monero-wallet-cli for future integration test.
2024-06-11 14:47:01 +07:00
ditatompel
1429cde662
Uppercase CheckAPI test func
Ref cd52dc7
2024-06-10 03:23:03 +07:00
ditatompel
cd52dc7b70
Lowercase & upperase initialism acronyms
See https://google.github.io/styleguide/go/decisions#initialisms
2024-06-10 03:03:23 +07:00
ditatompel
5f5ebd81a9
Reuse existing db connection (if any) 2024-06-10 02:47:44 +07:00
ditatompel
70372e58ab
Changed the initialization of the countries slice 2024-06-08 00:53:28 +07:00
ditatompel
054a4809dd
No need to use ptr for NetFee 2024-06-08 00:37:26 +07:00
ditatompel
459271408d
test: Unit test for parseStatuses() 2024-06-03 22:18:24 +07:00
ditatompel
ced90fde8e
feat: Function to parse node statuses from report 2024-06-03 22:13:12 +07:00
ditatompel
85f3169689
Only call time.Now() once 2024-06-03 19:26:12 +07:00
ditatompel
54d82e0c8f
fix: RowsPerPage nodes API return zero
Forget to set RowsPerPage response
2024-06-03 13:18:52 +07:00
ditatompel
48fe09c1cb
Adding table tbl_fee
This table used to store majority fee of monero nettype.
By calculating majority fee via "cron" every 300s, the function to
get majority fee for nettypes can be done with single query.

The frontend majority static data in the frontend removed and
now use `/api/v1/fees` endpoint to get majority fee value.

Note: Don't know if it works well with `onload` method or not. Let see.
2024-05-31 16:28:21 +07:00
ditatompel
55f6af1f22
Change estimate fee for stagenet to 56000
TODO: Create in-memory cache for NetFees function.
2024-05-31 13:30:56 +07:00
ditatompel
e83045f8b5
toSQL function for QueryLog struct 2024-05-31 13:04:53 +07:00
ditatompel
8b5bdc7523
toSQL function for QueryProber struct
Make the unit test easier
2024-05-30 20:14:16 +07:00
ditatompel
acc70111c8
fix: slog args message become slog.Attr 2024-05-30 19:41:03 +07:00
ditatompel
a11986ac0c
Separating QueryNode to it's own sql builder func
A quick note that is's ok to use "*" all columns on nodes query
since all columns really want to be displayed to the frontend.
2024-05-30 19:19:03 +07:00
ditatompel
4800bb3284
Adding test and bench example 2024-05-30 15:47:27 +07:00
ditatompel
130cd06dc4
Make X-Prober-Api-Key as constant 2024-05-30 13:40:57 +07:00
ditatompel
0b331ec6c6
Lowercase & upperase initialism acronyms
See https://google.github.io/styleguide/go/decisions#initialisms
2024-05-30 12:46:33 +07:00
ditatompel
38320bc316
Rename NewProberRepo to NewProber
Also rename ProbersQueryParams to QueryProbers
2024-05-27 07:17:27 +07:00
ditatompel
ab82985bdf
Rename MoneroLogQueryParams to QueryLogs
The reason is same with commits reference 99a367f04b
2024-05-27 06:38:11 +07:00
ditatompel
6b5225758e
Rename NewMoneroRepo to just New
Just run `monero.New()` to initialize MoneroRepository.

The database connection is now called from the `New()` function
2024-05-27 06:15:40 +07:00
ditatompel
99a367f04b
chore: Renamed MoneroQueryParams
The `MoneroQueryParams` renamed to `QueryNodes`.
It become much more readable when calling it.

Also added some comment in some functions.
2024-05-27 05:13:03 +07:00
ditatompel
c25e9224b6
lint: No err check 2024-05-24 05:37:27 +07:00
ditatompel
2270fe4deb
Secret key environment variable no longer needed 2024-05-23 03:57:29 +07:00
ditatompel
253230dc5a
Removing admin module and functions
The administration of the server is done using cli tools. So I don't
think that admin account and module is required. At least for now.

Note that this also remove `tbl_admin` creation in database migrate.
Since no release were made until this commit, the database migration
still in version 1. Manual removal database table for `tbl_admin`
is required on the existing running server.
2024-05-23 03:40:06 +07:00
ditatompel
40b9a6e1d6
Make sure cron goroutine is stopped
Adding struct chan to run cron Process to stop the goroutine.

Moving db migration inside `fiber.IsChild` block
to avoid multiple execution migration script when in prefork mode.

Give additional time for graceful shutdown.
2024-05-23 02:58:58 +07:00
ditatompel
8c1f6b0c43
Make cron as it's own package 2024-05-23 02:24:06 +07:00
ditatompel
ddc448e90c
Moving monero.go to its own internal package 2024-05-22 22:45:38 +07:00
ditatompel
7d69e9af95
chore: Make SQL queries in more readable 2024-05-20 04:22:58 +07:00
ditatompel
fae32d9a74
chore: Make SQL queries in more readable 2024-05-20 03:08:48 +07:00
ditatompel
30b37b922f
Ability to list cron from CLI #2
Since `tbl_cron` will contain a few rows (for now just 1),
cron list function call is not using any arguments.

This commit also remove cron http handler and endpoint.
2024-05-18 20:13:00 +07:00
ditatompel
120ba51c87
Ability to edit prober name by ID from CLI #2 2024-05-18 19:50:20 +07:00
ditatompel
b5e2787420
Ability to delete prober by ID from CLI #2 2024-05-18 19:39:27 +07:00
ditatompel
d2f927e3db
Ability to add prober from CLI #2 2024-05-18 19:03:56 +07:00
ditatompel
59f1dd9421
List Probers CLI command #2
Listing probers is now only available from server CLI.

The `ProbersQueryParams` struct also changed. I don't think that I will
use more than 20 probers in this project, so paging is not required.

The search param also simplified in one field struct `Search" which
search both in `name` and `api_key` column.
2024-05-18 00:56:13 +07:00
ditatompel
46bc3dc2e8
Using slog for logging level
The log level for the apps is using `log/slog` from Go standard library.
This commit change log format for fiber http logger to match with
the slog standard log format (date and time).

This commit also remove `APP_DEBUG` field from config struct.

TODO:
Use `slog` for default app output. Note that in this commit, the `slog`
output only implemented in `cron` "db migrate" and probe client.
2024-05-13 18:40:01 +07:00
ditatompel
d3113bf598
feat: MySQL db migration
Create database schema migration for this app that run when the `serve`
command is executed.
2024-05-12 04:19:40 +07:00
ditatompel
efca11e51c
Make nettype and protocol query more strict
It will return error if nettype and protocol query string value is wrong
2024-05-09 20:44:49 +07:00
ditatompel
ec11fa0126
removing current page & next page in api response
This response was used for my HTMX "infinite scroll" data, which is not
used in this Svelte project.
2024-05-09 18:29:48 +07:00
ditatompel
5496692c5d
Avoid naming module using a domain name pattern
I hope it will be less discoverable by other users and less likely to
be used unintentionally in other projects.
2024-05-08 21:35:04 +07:00
ditatompel
edb27100bb
chore: Indention query 2024-05-08 19:29:26 +07:00
ditatompel
738c0826c8
Delete old probe logs older than 1 month +2 days 2024-05-08 19:28:42 +07:00
ditatompel
f931066c8c
Keep nettype, height, etc same as before
Do not replace existing database record if prober can't reach the remote
nodes. Only update node status and last fetch record.
2024-05-08 19:03:41 +07:00
ditatompel
8821ad7995
Make cron datatable filterable 2024-05-08 17:24:34 +07:00
ditatompel
50588da322
Edit prober name action 2024-05-07 23:23:31 +07:00
ditatompel
09490a8250
Adding prober delete action 2024-05-07 22:37:36 +07:00
ditatompel
32ef14d1d5
Update prober last activity timestamp
This executed after prober submit fetch report
2024-05-07 22:01:21 +07:00
ditatompel
2a4721b8de
Add filter log by failed reason and status 2024-05-07 21:31:40 +07:00
ditatompel
d04473a807
Add details node by ID endpoint 2024-05-07 01:08:01 +07:00
ditatompel
9aad56103a
Delete old probe logs task 2024-05-06 18:40:09 +07:00
ditatompel
34e4d8c98d
Delete monero node uptime <= 0% with > 300 records 2024-05-06 17:45:18 +07:00
ditatompel
8f5f972faf
Simple display probe logs 2024-05-06 17:19:17 +07:00
ditatompel
33aae21237
Filter datatable (backend)
Adding filter by country, protocol, status, cors and nettype
2024-05-06 14:33:13 +07:00
ditatompel
59b368d91e
Add monero country list endpoint (backend) 2024-05-06 13:35:15 +07:00
ditatompel
1ceb00543b
Adding majority net fee
Note that because this app not caching "expensive" query from database,
I use static majority data for frontend to reduce API call.
2024-05-06 13:19:48 +07:00
ditatompel
92472c2616
Fix country name and country code json response 2024-05-05 02:27:20 +07:00
ditatompel
553aca1074
Adding GeoIP support 2024-05-05 02:20:54 +07:00
ditatompel
1baddfd2d1
Process submitted job from prober 2024-05-05 01:42:47 +07:00
ditatompel
e9577b9bcf
Follow the monero RPC response
This commit change database name and MoneroNode struct:

- `NodeVersion` to `Version`
- `LastHeight` to `Height`

This commit also add `Status` to the MoneroNode struct.
2024-05-04 22:53:03 +07:00
ditatompel
8724b81431
Probe (client) check remote node
Please note that this commit is not complete. I commit to the repo
because I have something to do with my another project. Just don't
want to lost my work for the last couple hours.
2024-05-04 22:36:57 +07:00
ditatompel
cee2b4341b
Add prober API key check middleware 2024-05-04 19:52:22 +07:00
ditatompel
6430e37548
Give job api response 2024-05-04 19:27:21 +07:00