-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7465b7a
Showing
48 changed files
with
7,455 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: docs | ||
on: | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
contents: write | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- | ||
- run: pip install mkdocs-material mkdocs-awesome-pages-plugin | ||
- run: mkdocs gh-deploy -f ./docs/src/mkdocs.yml --force | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test with race check | ||
run: make testIncCovRep | ||
|
||
- name: Test without race check | ||
run: make testIncCovRepNoRace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bin/ | ||
*bkp | ||
*out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [0.0.1] - 2023-10-30 | ||
|
||
### Added | ||
|
||
- TCP Load Balancing | ||
- round-robin distribution mode | ||
- TCP upstream health check | ||
- Upstream health check starts available/unavailable | ||
- Configurable upstream health check timeout | ||
- Configurable upstream health check interval | ||
- Configurable upstream health check success count healthy threshold | ||
- Upstream FQDN address | ||
- Upstream FQDN resolution DNS list and DNS backup | ||
- Upstream DNS TTL overwrite | ||
- YAML file based config | ||
- Hot config reload | ||
- Basic metrics | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License | ||
|
||
This work is licensed under [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
BINARY_DIR = bin | ||
BINARY_NAME = lobby | ||
RUN_ARCH = linux/amd64 | ||
|
||
# Go parameters | ||
GOCMD = go | ||
GOBUILD = $(GOCMD) build | ||
GOTEST = $(GOCMD) test | ||
GOGET = $(GOCMD) get | ||
GOCLEAN = $(GOCMD) clean | ||
GOTOOL = $(GOCMD) tool | ||
GOCOVFN = coverage.out | ||
CGO_ENABLED = 0 | ||
|
||
# Build flags and arguments | ||
LDFLAGS = -ldflags="-s -w -X main.version=$(version)" | ||
GCFLAGS = -gcflags="-m -l" | ||
MODFLAGS = -mod=readonly | ||
TRIMPATH = -trimpath | ||
|
||
# Cross-compilation target architectures | ||
TARGETS = \ | ||
linux/arm64 \ | ||
linux/amd64 | ||
|
||
.PHONY: build clean run | ||
|
||
# check version is set | ||
valver: | ||
version := v$(shell grep -oE '\[[^]]+\]' CHANGELOG.md | sed -n '4{s/\[//;s/\]//p}') | ||
ifeq ($(shell echo $(version) | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$'),$(version)) | ||
$(info Version '$(version)' is in the correct format) | ||
else | ||
$(error Version is not in the correct format. Check CHANGELOG.md) | ||
endif | ||
|
||
# go get dependencies | ||
get: | ||
$(GOGET) . | ||
|
||
# Build for all the configured target architectures (TARGETS) | ||
build: valver get $(TARGETS) | ||
|
||
$(TARGETS): | ||
GOOS=$(word 1, $(subst /, ,$@)) GOARCH=$(word 2, $(subst /, ,$@)) CGO_ENABLED=$(CGO_ENABLED)\ | ||
$(GOBUILD) $(LDFLAGS) $(GCFLAGS) $(MODFLAGS) $(TRIMPATH) \ | ||
-o $(BINARY_DIR)/$(BINARY_NAME)-$(word 1, $(subst /, ,$@))-$(word 2, $(subst /, ,$@)) | ||
|
||
# Clean builds | ||
clean: | ||
rm -f $(BINARY_DIR)/$(BINARY_NAME)-* | ||
|
||
# Build and run | ||
run: build | ||
./$(BINARY_DIR)/$(BINARY_NAME)-$(word 1, $(subst /, ,$(RUN_ARCH)))-$(word 2, $(subst /, ,$(RUN_ARCH))) | ||
|
||
# Includes race testing | ||
test: | ||
$(GOTEST) -cover -race -failfast | ||
|
||
# Includes race testing and coverage report | ||
testIncCovRep: | ||
$(GOCLEAN) -testcache | ||
$(GOTEST) -v -cover -race -failfast -coverprofile=$(GOCOVFN) | ||
@if [ $$? -eq 0 ]; then $(GOTOOL) cover -html=$(GOCOVFN); fi | ||
rm -rf coverage.out | ||
|
||
# Excludes race testing as some testing functions fail on race tests (not the app) | ||
# Higher unit test coverage with this option | ||
testIncCovRepNoRace: | ||
$(GOCLEAN) -testcache | ||
$(GOTEST) -v -cover -failfast -coverprofile=$(GOCOVFN) | ||
@if [ $$? -eq 0 ]; then $(GOTOOL) cover -html=$(GOCOVFN); fi | ||
rm -rf coverage.out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<p align="center"> | ||
<picture> | ||
<img alt="Lobby" title="Lobby" src="docs/content/assets/img/lobbyGopherLogo.png"> | ||
</picture> | ||
</p> | ||
|
||
**Lobby** is a simple, yet highly performant, load balancer based on Linux [nftables](https://wiki.nftables.org/wiki-nftables/) designed to run as a portable binary app on Linux systems in amd64 and arm64 architectures. | ||
|
||
# Quick Start | ||
Use the helper script which downloads the latest Lobby binary to your current folder and sets a sample config file. | ||
|
||
``` bash | ||
wget -O - https://ipbuff.com/getLobby | sh | ||
``` | ||
|
||
Once the script completes, it will inform you about the required permissions and the need for IP forwarding to be enabled. | ||
|
||
For testing purposes it might be easier to run Lobby with the `root` user. Run Lobby with: | ||
|
||
``` bash | ||
./lobby | ||
``` | ||
|
||
To check on how to run it as unprivileged user check [here](https://lobby.ipbuff.com/installation/#permissions). | ||
|
||
To edit the Lobby settings, edit the `lobby.conf` file. Configuration documentation may be found [here](https://lobby.ipbuff.com/configuration). | ||
|
||
A relatively extensive tutorial can also be found in the Lobby documentation. Make sure to check it for many practical examples. | ||
|
||
# Documentation | ||
The Lobby documentation is published at [https://lobby.ipbuff.com](https://lobby.ipbuff.com). | ||
|
||
The documentation source is in the [./docs/src](https://github.com/ipbuff/lobby/tree/main/docs/src) directory of this repository. | ||
|
||
# Credits | ||
This project has been created by [Igor Borisoglebski](https://igor.borisoglebski.com). | ||
|
||
[Gopher Konstructor](https://quasilyte.dev/gopherkon/), created by [quasilyte](https://github.com/quasilyte/gopherkon) was used for the logo creation. | ||
|
||
# License | ||
This work is licensed under [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/). | ||
|
||
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License |
Oops, something went wrong.