Skip to content

Commit

Permalink
rewrite: everything (#202)
Browse files Browse the repository at this point in the history
* revise: codebase

* fix: remove old .vscode and .github dir

* feat: cache status response packet

* add scripts folder with a simple test script inside of it

* simplefy `RespondeToServerRequest` a little

* improve readability hash implemetation of status cache

* Implement sending proxy protocol header to backend server for login requests.

* remove redundant test script

* remove pk.WriteTo(hash) statement and remove redundant Sum64 call of hash

* don't expose cacheResponse method for now

* refactor: one port to bind them all (#197)

* refactor: listener to only one

* refactor: into methods

* feat: add config file loading (#194)

* feat: add rate limiter (#201)

* feat: add server addresses

* feat: add config file loading

* fix: proxy protocol

Signed-off-by: haveachin <[email protected]>

* feat: add rate limiter

Signed-off-by: haveachin <[email protected]>

* refactor: middleware to filter

Signed-off-by: haveachin <[email protected]>

* refactor: more testability

* refactor: listener to only one

* refactor: config files

* feat: add config file loading

* refactor: filter for only one listener

* feat: add docs

* docs: add config docs

* refactor: file loading

* refactor: remove unnecessary mutex

* docs: clean up readme

* feat: add linting, ci and release automation

* docs: add rate limiter

* fix: linting errors

* fix: linting errors

* fix: linting errors

* chore: clean up

* refactor: ServerRequester

* feat: add zerolog

* chore: clean up

---------

Signed-off-by: haveachin <[email protected]>

---------

Signed-off-by: haveachin <[email protected]>
Co-authored-by: realDragonium <[email protected]>
  • Loading branch information
haveachin and realDragonium authored Feb 2, 2024
1 parent 596ff33 commit 217e643
Show file tree
Hide file tree
Showing 103 changed files with 6,502 additions and 6,171 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: haveachin
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: haveachin
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://paypal.me/hendrikschlehlein # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
27 changes: 0 additions & 27 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- master
- main
pull_request:

permissions:
contents: read

env:
GO_VERSION: 1.21

jobs:
test:
name: Test
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- name: Test
run: make test

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
args: build --snapshot
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint

on:
push:
branches:
- master
- main
pull_request:

permissions:
contents: read
pull-requests: read
checks: write

env:
GO_VERSION: 1.21

jobs:
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.55.2

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- "*"

permissions:
contents: write
packages: write

env:
GO_VERSION: 1.21

jobs:
release:
name: Build & Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140 changes: 0 additions & 140 deletions .github/workflows/test-build-release.yml

This file was deleted.

31 changes: 19 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Artifacts
out/
__debug_bin*
dist/

# Test binary, build with `go test -c`
# Benchmark/Profiler
*.bench
*.test
*.prof

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Local Dev Files
.dev/
cmd/infrared/config.yml

# Config files
*.yaml
# VSCode Dev Files
.vscode/

.idea
# IntelliJ Dev Files
.idea/

# Docs
docs/node_modules/
docs/.vitepress/cache/
docs/.vitepress/dist/
Loading

0 comments on commit 217e643

Please sign in to comment.