Skip to content

Commit a6334eb

Browse files
committed
feat(void): push void cli + daemon
0 parents  commit a6334eb

File tree

30 files changed

+4773
-0
lines changed

30 files changed

+4773
-0
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write # needed to create GitHub Releases
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: 1.21.x
25+
26+
- name: Install Goreleaser
27+
uses: goreleaser/goreleaser-action@v5
28+
with:
29+
version: latest
30+
31+
- name: Run Goreleaser
32+
run: goreleaser release --clean
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
3+
dist/

.golangci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: "2"
2+
run:
3+
timeout: 5m
4+
tests: true
5+
linters:
6+
enable:
7+
- errcheck
8+
- govet
9+
- staticcheck
10+
- revive
11+
- gocritic
12+
- gosec
13+
- ineffassign
14+
- unused
15+
- goconst
16+
settings:
17+
errcheck:
18+
check-type-assertions: true
19+
check-blank: true
20+
exclusions:
21+
generated: lax
22+
presets:
23+
- comments
24+
- common-false-positives
25+
- legacy
26+
- std-error-handling
27+
rules:
28+
- linters:
29+
- errcheck
30+
- gosec
31+
path: _test\.go
32+
- linters:
33+
- revive
34+
text: should have comment or be unexported
35+
source: ^func New.*$
36+
paths:
37+
- mocks
38+
- third_party$
39+
- builtin$
40+
- examples$
41+
issues:
42+
max-issues-per-linter: 0
43+
max-same-issues: 0
44+
formatters:
45+
enable:
46+
- gofmt
47+
- goimports
48+
settings:
49+
gofmt:
50+
simplify: true
51+
goimports:
52+
local-prefixes:
53+
- github.com/lc/void
54+
exclusions:
55+
generated: lax
56+
paths:
57+
- mocks
58+
- third_party$
59+
- builtin$
60+
- examples$

.goreleaser.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: 1
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
7+
8+
builds:
9+
- id: void
10+
main: ./cmd/void
11+
binary: void
12+
env:
13+
- CGO_ENABLED=0
14+
goos:
15+
- darwin
16+
goarch:
17+
- amd64
18+
- arm64
19+
ldflags:
20+
- "-X github.com/lc/void/internal/buildinfo.Version={{.Version}} -X github.com/lc/void/internal/buildinfo.Commit={{.ShortCommit}}"
21+
22+
- id: voidd
23+
main: ./cmd/voidd
24+
binary: voidd
25+
env:
26+
- CGO_ENABLED=0
27+
goos:
28+
- darwin
29+
goarch:
30+
- amd64
31+
- arm64
32+
ldflags:
33+
- "-X github.com/lc/void/internal/buildinfo.Version={{.Version}} -X github.com/lc/void/internal/buildinfo.Commit={{.ShortCommit}}"
34+
35+
archives:
36+
- id: default
37+
builds:
38+
- void
39+
- voidd
40+
format: tar.gz
41+
name_template: >-
42+
{{ .ProjectName }}_{{ .Os }}_{{ if eq .Arch "amd64" }}x86_64{{ else if eq .Arch "arm64" }}arm64{{ else }}{{ .Arch }}{{ end }}
43+
files:
44+
- LICENSE
45+
- README.md
46+
47+
changelog:
48+
sort: asc
49+
filters:
50+
exclude:
51+
- "^docs:"
52+
- "^test:"

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
VERSION ?= dev
2+
COMMIT ?= $(shell git rev-parse --short HEAD)
3+
LD_FLAGS = -ldflags "-X github.com/lc/void/internal/buildinfo.Version=$(VERSION) -X github.com/lc/void/internal/buildinfo.Commit=$(COMMIT)"
4+
5+
fmt:
6+
@go fmt ./...
7+
@gofumpt -l -w .
8+
9+
lint:
10+
@golangci-lint run ./...
11+
12+
test: fmt
13+
@go test -v ./...
14+
15+
build: fmt
16+
@go build $(LD_FLAGS) -o bin/void ./cmd/void
17+
@go build $(LD_FLAGS) -o bin/voidd ./cmd/voidd
18+
19+
release: fmt
20+
@VERSION=$(VERSION) COMMIT=$(COMMIT) make clean build
21+
22+
clean:
23+
@rm -rf bin/
24+
25+
.PHONY: fmt lint test build clean release

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# void
2+
3+
**Put distracting sites into the void. Works on macOS.**
4+
5+
Void is a lightweight, high-performance domain blocker that operates at the network level using macOS's built-in `pf` (Packet Filter). It blocks distracting websites by domain, resolving them to IPs and enforcing firewall rules—permanently or temporarily.
6+
7+
---
8+
9+
## Features
10+
11+
- Block domains with one command
12+
- Temporary or permanent rules
13+
- Uses macOS-native `pf` firewall (no kernel extensions)
14+
- Automatically re-resolves blocked domains, expires old rules, etc.
15+
16+
---
17+
18+
## Install
19+
20+
```bash
21+
go install github.com/lc/void/cmd/void@latest
22+
sudo go install github.com/lc/void/cmd/voidd@latest
23+
```
24+
25+
> Requires Go 1.20+ and root access to run the daemon (`voidd`).
26+
27+
---
28+
29+
## Usage
30+
31+
Start the daemon (must run as root):
32+
33+
```bash
34+
sudo voidd
35+
```
36+
37+
In a separate terminal, use the CLI:
38+
39+
```bash
40+
void block facebook.com # Permanently block
41+
void block twitter.com 2h # Temporarily block for 2 hours
42+
void list # View all current blocks
43+
```
44+
45+
---
46+
47+
## Config
48+
49+
By default, configuration is stored in `~/.void/config.yaml`:
50+
51+
```yaml
52+
socket:
53+
path: /var/run/voidd.socket
54+
rules:
55+
dns_refresh_interval: 1h
56+
dns_timeout: 5s
57+
```
58+
59+
Defaults are sensible if no config file is found.
60+
61+
---
62+
63+
## Architecture
64+
- `cmd/void`: User-facing CLI
65+
- `cmd/voidd`: Background daemon
66+
- `internal/`: Core engine, DNS resolver, rule management, pf integration
67+
- `pkg/api`: Minimal HTTP-over-UNIX socket API
68+
- `pkg/client`: CLI-to-daemon client
69+
70+
---

0 commit comments

Comments
 (0)