Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changes here need the maintainer's review: these parts run with system rights,
# decide what leaves the device, or decide what gets installed on it.

# the service and who may talk to it
/core/cmd/mistgate-clientd/ @limeflash
/core/internal/ipc/ @limeflash

# kill switch
/core/internal/firewall/ @limeflash

# adapter, routes, DNS, tunnel engines
/core/internal/netcfg/ @limeflash
/core/internal/engine/ @limeflash

# updates and signing
/ui/src-tauri/tauri.conf.json @limeflash
/ui/tools/ @limeflash

# CI and repository rules
/.github/ @limeflash
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ jobs:
- run: go vet ./...
- run: go test ./...

# No macOS engine or service yet: this keeps the shared packages building and their tests passing there.
# cmd/mistgate-clientd does not build for darwin; widen to ./... when it does.
service-macos:
name: service (Go, macOS)
runs-on: macos-15
defaults:
run:
working-directory: core
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-go@v5
with:
go-version-file: core/go.mod
cache-dependency-path: core/go.sum
- run: go vet ./internal/...
- run: go build ./internal/...
- run: go test ./internal/...

window:
name: window (TypeScript, Rust)
runs-on: windows-latest
Expand Down
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Contributing

Thanks for wanting to help. This is a VPN client: part of it runs with system rights and all of it sits between a
person and a network that may be hostile, so changes are reviewed slowly and in small pieces.

## Before you start

For anything larger than a fix, open an issue first and say what you want to change. It saves you from writing
something that cannot be taken in.

Security problems do not go into public issues: use "Report a vulnerability" on the repository's Security tab.

Never put real subscription links, server addresses, domains, keys or logs with them into issues, pull requests,
commits or tests. Use `example.com`, `192.0.2.0/24`, `2001:db8::/32`.

## Pull requests

- **Small, one topic each.** A rough limit is 500 changed lines of code, tests aside. A large piece of work comes as a
series of pull requests that each build and pass on their own.
- **No refactoring mixed with behaviour.** Moving or renaming code is one pull request, changing what it does is
another.
- **Windows behaviour stays as it is** unless the change is the point of the pull request and its description says so.
Code shared between platforms counts: say what changes for Windows, even if the answer is "nothing".
- **Tests.** New behaviour and fixed bugs come with tests. `go vet ./...` and `go test ./...` in `core/`,
`pnpm exec tsc --noEmit` in `ui/`, `cargo check --locked` in `ui/src-tauri/` must pass; CI runs them on Windows and
the service's packages on macOS as well.
- **Say how it was checked** on a real machine: system and version, which protocols, what you looked at. "Works for
me" without that is not enough for anything that touches the network.
- **No tool leftovers**: editor and agent folders, code indexes, plans written for an assistant, local notes, build
output.
- **New dependencies** are discussed first: what for, its licence, what the alternative is.
- **Based on the current `main`**, commit messages in English, one line saying what changed, in the style of
`git log --oneline`.

## Parts that need the maintainer

`.github/CODEOWNERS` lists them: the service and its IPC (who may give it commands), the kill switch, the network
layer and tunnel engines, updates and signing, CI. Changes there are welcome but get a separate, stricter review;
keep them apart from everything else.

These stay with the maintainers and are not accepted in pull requests: code signing and notarization, the release
builds and their publication, the update signing key and the public key in `ui/src-tauri/tauri.conf.json`, CI secrets.

## Licence and sign-off

The project is under AGPL-3.0 (`LICENSE`); your contribution is taken under the same licence. Every commit carries a
sign-off line (`git commit -s`), by which you state the
[Developer Certificate of Origin 1.1](https://developercertificate.org/): you wrote the change or otherwise have the
right to submit it under this licence. If you write code as part of your job, make sure your employer lets you
contribute it.

Code copied or adapted from another project is named in the pull request, with its licence, and keeps its notices.

## Code written with AI tools

Allowed, and it must be said: note in the pull request which parts an assistant wrote. You answer for such code as
for your own - you have read it, you understand it, you tested it, and the sign-off covers it.
1 change: 1 addition & 0 deletions core/internal/auto/asn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestASNNet(t *testing.T) {
if again.ASNNet("s1") != "" {
t.Fatal("an unknown network left the old note")
}
again.Flush() // the change above started a save of its own: it must be over before the directory goes
var none *Memory // a nil memory remembers nothing
none.SetASNNet("s1", "net-a")
if none.ASNNet("s1") != "" {
Expand Down
5 changes: 0 additions & 5 deletions core/internal/engine/gvisor_bridge_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,11 +1038,6 @@ var directIPv6 = func() bool { // a variable for the tests
return ok == 1
}

func directAddressAllowed(address netip.Addr) bool {
return address.IsValid() && !address.IsPrivate() && !address.IsLoopback() && !address.IsLinkLocalUnicast() &&
!address.IsLinkLocalMulticast() && !address.IsMulticast() && !address.IsUnspecified()
}

// hasGlobalIPv6 says whether the interface has an address that IPv6 on the Internet can use.
func hasGlobalIPv6(index uint32) bool {
iface, err := net.InterfaceByIndex(int(index))
Expand Down
6 changes: 6 additions & 0 deletions core/internal/engine/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,9 @@ func (entry dnsEntry) hasLiveName(now time.Time) bool {
}
return false
}

// directAddressAllowed says whether an address may leave past the tunnel at all: only public unicast ones.
func directAddressAllowed(address netip.Addr) bool {
return address.IsValid() && !address.IsPrivate() && !address.IsLoopback() && !address.IsLinkLocalUnicast() &&
!address.IsLinkLocalMulticast() && !address.IsMulticast() && !address.IsUnspecified()
}
2 changes: 2 additions & 0 deletions core/internal/firewall/blocker.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build windows

/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2019-2026 WireGuard LLC. All Rights Reserved.
Expand Down
2 changes: 2 additions & 0 deletions core/internal/firewall/helpers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build windows

/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2019-2026 WireGuard LLC. All Rights Reserved.
Expand Down
2 changes: 2 additions & 0 deletions core/internal/firewall/lan.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build windows

/* SPDX-License-Identifier: MIT
*
* Mistgate's addition to the WireGuard for Windows firewall package (see README.md here).
Expand Down
2 changes: 2 additions & 0 deletions core/internal/firewall/rules.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build windows

/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2019-2026 WireGuard LLC. All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion core/internal/firewall/types_windows_32.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build 386 || arm
//go:build windows && (386 || arm)

/* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion core/internal/firewall/types_windows_64.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build amd64 || arm64
//go:build windows && (amd64 || arm64)

/* SPDX-License-Identifier: MIT
*
Expand Down
13 changes: 13 additions & 0 deletions core/internal/ipc/server_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build !windows

package ipc

import (
"context"
"errors"
)

// runPipeServer exists so the package builds and its tests run off Windows; there is no transport there yet.
func runPipeServer(context.Context, *Server) error {
return errors.New("ipc: no transport on this platform")
}
Loading