golint has been deprecated and archived. There's no 1:1 match for it,
but staticcheck is a checker the golint README recommends and has tons
of useful checks.
This commit enables all checks, and then disables:
* ST1000: Incorrect or missing package comment
* ST1005: Incorrectly formatted error string, necessary due to the fact
that all our error strings are capitalised, which they should not be
* SA1019: Locally in goneb.go because we have to rework how we use the
prometheus package there
It also fixes a number of other errors surfaced by staticheck.
* Handle SAS verification by exposing an endpoint where the SAS can be sent to be verified
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Init cryptotest service with basic commands
* Add cryptotest service with challenge request / response / session invalidation commands
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Add cryptotest methods for testing key forwarding
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Add help messages for cryptotest cmds
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Add newer apt repository for updated libolm
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Move command functionalities for cryptotest to different functions
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Fixed cryptotest service and package name from echo
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Control which users can start a SAS verification with Neb through regexes in the config
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Have maximum number of ongoing verifications at any time
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Fix Trace to Tracef
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Add device ID to the configuration
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Basic e2ee support for some commands
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Move some of the client and crypto logic to a new BotClient type
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Use the state store to retrieve room joined users
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Start creating the database APIs for the crypto store
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Replace mautrix.Client usage with BotClient for all services to use the
e2ee-enabled client
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Use SQL backend for storing crypto material
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Perform a sync request with full state when starting
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Consider case where device ID is empty and log a warning
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Define project as a Go module and update dependency versions
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Update docs, configs and dockerfile to use latest Go version
Signed-off-by: Nikos Filippakis <me@nfil.dev>
* Add postgres database driver
Signed-off-by: Nikos Filippakis <me@nfil.dev>
We exclusively view logs using `less` and `tail`. These do not read JSON well.
Logging as JSON makes it a PITA to read logs and debug problems. We do not
appear to make use of JSON logging, and have no good terminal-based
structured log viewer either.
As a result, I've now removed JSON logging from this project and replaced it
with the standard `TextFormatter` (colors off). This still logs in a structured
way:
```
time="2016-11-18 16:25:46.787373" level=info msg="Got filter ID" filter=717 syncing=1 user_id="@goneb:localhost"
time="2016-11-18 16:25:46.787525" level=info msg="Starting sync" next_batch="s26928_287972_2_1029_26_1_2" syncing=1 user_id="@goneb:localhost"
```
So we can still analyse logs sanely at a later date should we need to. This
feels like the best compromise here between pragmatism and ideals.
- Pass in an `envVars` struct rather than grabbing directly from `os`.
- Accept a `ServeMux` rather than always using the default mux.
- Add a `_test.go` file to instrument Go-NEB using `TestMain` to call `setup()`
Because apparently "Feed Reader" is the name of a thing popular enough that we
don't want to step on toes, so let's call it the name of a less popular thing.
Just need to send messages into rooms now for a first cut to be done. Notable
improvements to make:
- We currently do 1 goroutine per service. This could be bad if we have lots of these things running around.
- We do not cache the response to RSS feeds. If we have 10 independent services on the same feed URL, we will
hit the URL 10 times. This is similar to how we currently do 1 webhook/service, so it's plausible that in
the future we will want to have some kind of generic caching layer.
- We don't send messages to Matrix yet. We need a `Clients` instance but can't get at one. There's only ever
one, so I wonder if we should global it like we do with `GetServiceDB()` for ease of use?
- The polling interval is divorced from the actual feed repoll time. Ideally we would schedule the goroutine
only when we need it, rather than checking frequently, determining we have nothing to do, and going back
to sleep.
* WIP: Initial Guggy
* Finish Guggy integration
* typo & send No GIF Found when GIF string empty
* unused function
* Unused import, HTTPS API and GIFs
* APIKey -> api_key
* Use api_key on the wire, APIKey in structs
Allows users to nuke their OAuth credentials. Currently this just does a database
`DELETE` as neither Github nor JIRA need you to hit any special `/logout` API.
Previously, we would notify `Services` based on matching the `room_id` of the
event with a list of `RoomIDs()` which the service returned.
Now we notify `Services` based on matching the `user_id` of the client listening
for events. This means that the service will receive more events because there
isn't a filter on a set of room IDs.
This is required in order to implement "auto-join on invite" semantics for
Services, as the room ID is not known at that point in time.
Add a new `AuthSession` function `Authenticated()` which returns `true` if the
user has completed the auth process. This allows the caller to distinguish
between:
- Never done any auth (404s)
- In the process of doing auth (`Authenticated == false`)
- Finished doing auth (`Authenticated == true`)