# Building

## Go

Requires Go 1.24 or later.

```bash
go build -o softether-go ./cmd/softether-go/
```

### Static binary

For deployment in minimal containers (Alpine, scratch) or systems without glibc:

```bash
CGO_ENABLED=0 go build -o softether-go ./cmd/softether-go/
```

### Cross-compilation

```bash
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o softether-go ./cmd/softether-go/
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o softether-go ./cmd/softether-go/
```

Only Linux targets are supported (the TAP device interface uses Linux-specific ioctls).

## Nix

Build with the flake:

```bash
nix build
```

The result is in `./result/bin/softether-go`.

Enter a development shell with Go tooling:

```bash
nix develop
```

Build within the dev shell:

```bash
nix develop -c bash -c 'go build -o softether-go ./cmd/softether-go/'
```

## Dependencies

The only Go dependency is `golang.org/x/sys` for Linux syscall constants (TUN/TAP ioctls). Dependencies are vendored in `vendor/`.

At runtime, the only external dependency is `ip` (iproute2) for route and address management.
