Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
all: initial commit
.editorconfig | 11 +++++++++++ COPYING | 19 +++++++++++++++++++ README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..6ab52d0668c79b49696928f44afa493c74f60864 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{md,scd}] +max_line_length = 80 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..22320bd6f73b9b4d62cd3751a93fdeff6b83400b --- /dev/null +++ b/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2021 Pedro Lucas Porcellis + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..77ae8ebfb56fd4c91ca6430a41eb7351c5710c85 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# antispam API + +This is a simple bare-bones API for the [antispam project][antispam]. It's +written in Go and spits a simple daemon. + +[antispam]: https://sr.ht/~porcellis/antispam + +## Running + +Generate the daemon using `make(1)`. There's a rule that'll fetch the latest +data from the [repository][repository], crunch it as JSON and compile the +daemon. Then you can just run: + +```sh +$ antispam serve +``` + +It'll go live on port 8121. You can supply an alternative port passing a second +argument like `:3333`. Serve it via a reverse proxy on your server and you're +done. + +A public instance is available at +[antiweb.eletrotupi.com](https://antiweb.eletrotupi.com). + +[repository]: https://git.sr.ht/~porcellis/antispam + +## Endpoints + +The API will either returns 200 (OK) if the domain is on the list or 404 (Not +Found) if not. + +`GET /domains` - Spits the list of domains + +`GET /domains/:domain` - Verify if the domain is on the list + +`GET /usernames` - Return the list of usernames + +`GET /usernames/:username` - Verify if the username is on the list + +## License + +MIT License. Check [COPYING][copying] + +[copying]: ./COPYING