Commit Graph

102 Commits

Author SHA1 Message Date
Ben Cartwright-Cox 411d2b262b Remove redundant runtime.GOMAXPROCS() setting
The default value of runtime.GOMAXPROCS is the number of CPUs. So
there is no need for this line to exist.
2023-01-19 11:50:23 +00:00
Erik Rozendaal 88719fec73 Rename variable for clarity 2022-10-18 11:18:48 +02:00
Erik Rozendaal 3aff120fc4 Document why we keep FirstSeen in case of visible VRP 2022-10-18 11:18:28 +02:00
Erik Rozendaal e2bcc18e4d Update inGracePeriod metric even when data source was not modified
Time still passes so VRPs may be dropped due to the expiration of the
grace period.
2022-10-18 11:11:06 +02:00
Erik Rozendaal 5a841b3c71 Go fmt 2022-10-18 11:01:19 +02:00
Erik Rozendaal 60e9818750 Ensure grace period is at least same as highest visibility threshold 2022-10-18 10:26:07 +02:00
Erik Rozendaal a1a2e32281 Clone updated VRPs to avoid mutating shared state 2022-10-18 10:04:35 +02:00
Erik Rozendaal 2854ce3130 Re-run comparison even when both sides have no updates
However, time does change so we need to account for the new thresholds
and grace period.
2022-10-18 09:10:59 +02:00
Erik Rozendaal 0f047b25b2 Track visibility of VRPs to avoid false positivies when a VRP disappears 2022-10-17 16:14:33 +02:00
Maria Matejka 4bd02cc8f3 Fixed SSH client key validation
The strings.HasPrefix() call was used with flipped argument order,
allowing incomplete rows in the authorized_keys file to any key matching
that prefix. In worst case, a line like

  ecdsa-sha2-nistp256

with no key at all would match all keys of that type.

On the other hand, when the key was followed by a comment as is common
in authorized_keys files, it wasn't matched at all.
2022-10-03 13:55:14 +02:00
Ties de Kock 8e9b738548 fix linter nit 2022-07-12 14:41:19 +02:00
Ties de Kock 8e57e8e6e0 Add tests for rtrmon expiry logic 2022-07-12 14:40:22 +02:00
Ties de Kock 6149d5f25d Add metric for number of VRPs in grace period 2022-07-11 17:41:40 +02:00
Ties de Kock b8b44aa9f4 Implement a grace period for disappearing VRPs
When a VRP disappears from one input, but it still present in the
other input, an immediate difference between sources is created.

This commits adds a grace period during which elements that disappear
do not cause alerts (yet).
2022-07-11 17:41:40 +02:00
Job Snijders 3df8c24472 Merge pull request #69 from ties/feature/add-index-page-to-rtrmon
Add index page to rtrmon
2022-07-11 12:24:58 +02:00
Ties de Kock 20d1bbc77c Add index page to rtrmon 2022-07-11 12:14:27 +02:00
Job Snijders aa7f025693 return if no vrps are loaded 2022-05-22 16:04:15 +00:00
Ties de Kock 1833aceccf Revert defer unlock in select/case
Hindsight... Agree with lspgn here, it is confusing that there is
a non-local effect (lock being held) that you will only hit when
you add code later in the same function.

I do not like the style of the alternatives (anonymous functions
called immediately) either.
2021-10-31 17:05:57 +01:00
Ties de Kock 3822cf8807 Do not defer unlock 'over' channel communication 2021-10-31 11:26:09 +01:00
Ties de Kock 4ddfd7f215 defer unlocks in rtrmon iff unlock happens before return 2021-10-30 16:16:32 +02:00
Darren O'Connor 91228f65e3 remove unused 2021-10-27 20:59:40 -04:00
Darren O'Connor 0b738b8ee2 GOMAXPROCS 2021-10-27 18:16:16 -04:00
Null User 5878317f6e Catch error and simplify the initial sync stuff 2021-10-27 04:36:47 +00:00
Null User 2455723c87 Make the refresh faster when update fails 2021-10-26 15:20:17 +00:00
Null User 76eac7450a Refresh faster when the VRPs weren't downloaded on init 2021-10-26 14:14:55 +00:00
Null User 6332b3ee71 Fix the crash in #39 2021-10-26 13:37:56 +00:00
Darren O'Connor c55254b8ff Controversial 2021-10-25 21:26:49 -04:00
Darren O'Connor 783f2eaf9f More test code 2021-10-25 20:52:41 -04:00
Job Snijders fb912e5c18 Merge pull request #35 from bgp/feature/add-codeql-actions
Add codeql actions
2021-10-25 20:07:31 +01:00
Ties de Kock 0a9217aaad Use local variable for password, not argument
Use the local variable (possibly containing a password from the
environment) for the SSH password.
2021-10-25 20:16:16 +02:00
Ties de Kock bd1a7d232f Document rtrmon behaviour and metrics
* Add how to run rtrmon in the README
  * Basic explanation of rtrmon metrics in the README
2021-10-25 19:45:16 +02:00
Job Snijders 876179b0d9 Use specific prometheus exporter port for rtrmon 2021-10-24 14:24:08 +00:00
Job Snijders 580a914a01 Switch to stayrtr specific Prometheus port 2021-10-24 14:22:45 +00:00
Darren O'Connor ef1da161e0 Bump to 1.16 and remove deprecated package 2021-10-24 10:04:09 -04:00
Ties de Kock 5f34f8c4f3 Abort when positional arguments are provided 2021-10-20 09:13:10 +00:00
Ties de Kock 03dff2d962 Refactor to update state when cache or SLURM changes
Before this commit the new stayrtr state was only recalculated
when the validated cache changed.

This commit refactors the update loop and separates the actual
update from pulling the updated cache. The update is triggered
when the SLURM file changes _or_ when the validated cache changes.

Should fix https://github.com/cloudflare/gortr/issues/95 and make
further changes that trigger an update when an update in the cache
has expired easier.
2021-10-20 09:13:10 +00:00
Ties de Kock 4a9a490985 Clarify how boolean options are disabled in the help text.
If they are disabled the wrong way (e.g. `-log.verbose false -loglevel debug`)
some of the arguments are eaten and later arguments no longer apply.
2021-10-20 09:13:10 +00:00
Job Snijders e9eba5e63f Add length checks 2021-10-20 09:13:10 +00:00
Job Snijders eaa1f0bee2 Convert a number of places from string to int 2021-10-20 09:13:10 +00:00
Job Snijders bcbffb50bc Add more test data 2021-10-20 09:13:10 +00:00
Ties de Kock 07b91f052f Visibility thresholds can be overridden via args
* Visibility thresholds can be overridden via command line arguments.
  * Format the default thresholds in help output
2021-10-20 09:13:10 +00:00
Ties de Kock a29da795ac Track objects that differ for a longer period separately
* Track when the VRP was first seen for each VRP
  * Add a metric which tracks how many objects that were first seen
    [duration] ago are not present in the other endpoint.
    * Use current naming convention for the metric to be consistent (i.e. no
      prefix with application name).
2021-10-20 09:13:10 +00:00
Job Snijders 38d058e133 more cleanup 2021-10-20 09:13:10 +00:00
Job Snijders eff66b2e0d More cleanups 2021-10-20 09:13:10 +00:00
Job Snijders 00bdf085ca remove unneeded dependencies 2021-10-20 09:13:10 +00:00
Job Snijders bea554ffbd by default emit some log output on stdout 2021-10-20 09:13:10 +00:00
Job Snijders 4a32f18e17 remove cf.pub 2021-10-20 09:13:10 +00:00
Job Snijders 9f9de8af55 Remove -verify option
This solves #2
2021-10-20 09:13:10 +00:00
Job Snijders 6d022d33bf remove key reference 2021-10-20 09:13:10 +00:00
Job Snijders 1e3201a89c flip some defaults 2021-10-20 09:13:10 +00:00