diff --git a/README.md b/README.md index e843186..d3f278e 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,42 @@ -# golang-cli-template -[![CI](https://github.com/bilalcaliskan/golang-cli-template/workflows/CI/badge.svg?event=push)](https://github.com/bilalcaliskan/golang-cli-template/actions?query=workflow%3ACI) -[![Docker pulls](https://img.shields.io/docker/pulls/bilalcaliskan/golang-cli-template)](https://hub.docker.com/r/bilalcaliskan/golang-cli-template/) -[![Go Report Card](https://goreportcard.com/badge/github.com/bilalcaliskan/golang-cli-template)](https://goreportcard.com/report/github.com/bilalcaliskan/golang-cli-template) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_golang-cli-template&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_golang-cli-template) -[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_golang-cli-template&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_golang-cli-template) -[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_golang-cli-template&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_golang-cli-template) -[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_golang-cli-template&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_golang-cli-template) -[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_golang-cli-template&metric=coverage)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_golang-cli-template) -[![Release](https://img.shields.io/github/release/bilalcaliskan/golang-cli-template.svg)](https://github.com/bilalcaliskan/golang-cli-template/releases/latest) -[![Go version](https://img.shields.io/github/go-mod/go-version/bilalcaliskan/golang-cli-template)](https://github.com/bilalcaliskan/golang-cli-template) +# split-the-tunnel +[![CI](https://github.com/bilalcaliskan/split-the-tunnel/workflows/CI/badge.svg?event=push)](https://github.com/bilalcaliskan/split-the-tunnel/actions?query=workflow%3ACI) +[![Go Report Card](https://goreportcard.com/badge/github.com/bilalcaliskan/split-the-tunnel)](https://goreportcard.com/report/github.com/bilalcaliskan/split-the-tunnel) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_split-the-tunnel&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_split-the-tunnel) +[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_split-the-tunnel&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_split-the-tunnel) +[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_split-the-tunnel&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_split-the-tunnel) +[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_split-the-tunnel&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_split-the-tunnel) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bilalcaliskan_split-the-tunnel&metric=coverage)](https://sonarcloud.io/summary/new_code?id=bilalcaliskan_split-the-tunnel) +[![Release](https://img.shields.io/github/release/bilalcaliskan/split-the-tunnel.svg)](https://github.com/bilalcaliskan/split-the-tunnel/releases/latest) +[![Go version](https://img.shields.io/github/go-mod/go-version/bilalcaliskan/split-the-tunnel)](https://github.com/bilalcaliskan/split-the-tunnel) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -## Required Steps -- Single command is mostly enough to prepare project, it will prompt you with some questions about your new project: - ```shell - $ make -s prepare-initial-project - ``` +## Overview +`split-the-tunnel` is a daemon that runs on Linux hosts. It is designed to add domains that bypass VPN, effectively creating a split tunnel. This allows for more efficient use of network resources and can improve network performance. -## Additional nice-to-have steps -- If you want to build and publish Docker image: - - Ensure `DOCKER_USERNAME` has been added as **repository secret on GitHub** - - Ensure `DOCKER_PASSWORD` has been added as **repository secret on GitHub** - - Uncomment **line 145** to **line 152** in [.github/workflows/push.yml](.github/workflows/push.yml) - - Uncomment **line 32** to **line 50** in [build/package/.goreleaser.yaml](build/package/.goreleaser.yaml) -- If you want to enable https://sonarcloud.io/ integration: - - Ensure your created repository from that template has been added to https://sonarcloud.io/ - - Ensure `SONAR_TOKEN` has been added as **repository secret** on GitHub - - Ensure `SONAR_TOKEN` has been added as **dependabot secret** on GitHub - - Uncomment **line 69** to **line 94** in [.github/workflows/pr.yml](.github/workflows/pr.yml) - - Uncomment **line 116** in [.github/workflows/push.yml](.github/workflows/push.yml) - - Uncomment **line 66** to **line 91** in [.github/workflows/push.yml](.github/workflows/push.yml) -- If you want to create banner: - - Generate a banner from [here](https://devops.datenkollektiv.de/banner.txt/index.html) and place it inside of [build/ci](build/ci) directory into a file **banner.txt** - - Uncomment **line 18** and **line 35** to **line 38** in [cmd/root.go](cmd/root.go) - - Run `go get -u github.com/dimiro1/banner` -- If you want to release as Homebrew Formula: - - At first, you must have a **formula repository** like https://github.com/bilalcaliskan/homebrew-tap - - Create an access token on account that has **formula repository** mentioned above item and ensure that token is added as`TAP_GITHUB_TOKEN` **repository secret** on GitHub - - Uncomment **line 165** in [.github/workflows/push.yml](.github/workflows/push.yml) - - Uncomment **line 70** to **line 80** in [build/package/.goreleaser.yaml](build/package/.goreleaser.yaml) -- If you want to mock your interfaces with [mockery](https://github.com/vektra/mockery): - - Add `generate-mocks` target as a prerequisite to all uncommented targets starting with `test` in [Makefile](Makefile) +## Features +- Runs as a daemon on Linux hosts +- Capable of adding domains to bypass VPN +- Creates a split tunnel for efficient network usage -## Used Libraries -- [spf13/cobra](https://github.com/spf13/cobra) -- [rs/zerolog](https://github.com/rs/zerolog) +## Installation +To install `split-the-tunnel`, you can download the latest binary from the [releases page](https://github.com/bilalcaliskan/split-the-tunnel/releases/latest) and add it to your PATH. + +## Usage +After installing `split-the-tunnel`, you can start the daemon with the following command: + +```shell +$ split-the-tunnel start +$ split-the-tunnel add --domain example.com +``` ## Development This project requires below tools while developing: - [Golang 1.21](https://golang.org/doc/go1.21) - [pre-commit](https://pre-commit.com/) -- [golangci-lint](https://golangci-lint.run/usage/install/) - required by [pre-commit](https://pre-commit.com/) -- [gocyclo](https://github.com/fzipp/gocyclo) - required by [pre-commit](https://pre-commit.com/) -After you installed [pre-commit](https://pre-commit.com/), simply run below command to prepare your development environment: +After you installed [pre-commit](https://pre-commit.com/) and the rest, simply run below command to prepare your +development environment: ```shell $ make pre-commit-setup ``` diff --git a/build/package/.goreleaser.yaml b/build/package/.goreleaser.yaml index 9b625f8..b79ac7d 100644 --- a/build/package/.goreleaser.yaml +++ b/build/package/.goreleaser.yaml @@ -1,9 +1,15 @@ --- project_name: split-the-tunnel +variables: + versionDir: internal/version + module: github.com/bilalcaliskan/{{ .ProjectName }} + env: - CGO_ENABLED=0 - GO111MODULE=auto +# - VERSION_DIR=internal/version +# - MODULE=github.com/bilalcaliskan/{{ .ProjectName }} before: hooks: @@ -17,9 +23,11 @@ builds: - darwin goarch: - amd64 - binary: golang-cli-template + binary: "{{ .ProjectName }}" ldflags: - - -s -w -X github.com/bilalcaliskan/split-the-tunnel/internal/version.gitVersion={{ .Version }} -X github.com/bilalcaliskan/split-the-tunnel/internal/version.gitCommit={{ .ShortCommit }} -X github.com/bilalcaliskan/split-the-tunnel/internal/version.buildDate={{ .CommitDate }} + - -s -w -X {{ .Var.module }}/{{ .Var.versionDir }}.gitVersion={{ .Version }} + - -s -w -X {{ .Var.module }}/{{ .Var.versionDir }}.gitCommit={{ .ShortCommit }} + - -s -w -X {{ .Var.module }}/{{ .Var.versionDir }}.buildDate={{ .CommitDate }} main: ./main.go archives: @@ -32,7 +40,7 @@ archives: release: github: owner: bilalcaliskan - name: split-the-tunnel + name: "{{ .ProjectName }}" changelog: sort: asc