A EUI-64 address calculator implemented in Go, HTMX, and Templ.
Inspired by ThePrincelle's EUI64-Calculator
Also available at https://eui64-calculator.nickfedor.com
This project is a simple web app for calculating EUI-64 IPv6 addresses.
- Enter a MAC Address in the format
xx-xx-xx-xx-xx-xx. - Enter an IPv6 Prefix.
- Click
Calculateto see the results.
docker run -d --name eui64-calculator nickfedor/eui64-calculator:latest-
Running the Basic Template:
docker compose -f ./examples/docker-compose.yaml up -d -
Traefik Reverse Proxy example
- Go 1.26+: https://go.dev/doc/install
- Templ: https://github.com/a-h/templ
- Make (optional, for Makefile targets)
- Task (optional, for Taskfile targets)
-
Clone the repository:
git clone https://github.com/nicholas-fedor/eui64-calculator.git -
Enter the repository:
cd eui64-calculator -
Install dependencies and generate templ files:
make generate -
Run the server:
make run -
The application will be accessible at http://localhost:8080/
This project provides both a Makefile and a Taskfile.yml for build automation. Both offer the same set of targets.
| Target | Description |
|---|---|
all / check |
Full CI check (lint, vet, test) |
generate |
Run go generate for templ code generation |
lint |
Run golangci-lint with project configuration |
vet |
Run go vet for static analysis |
fmt |
Format code and organize imports via golangci-lint |
test |
Run all tests |
test-race |
Run tests with the race detector enabled |
test-coverage / cover |
Run tests with HTML coverage report |
bench |
Run all benchmark tests |
run |
Run the server locally with version injection |
mod-tidy |
Tidy and verify go.mod dependencies |
docker-build |
Build binary and Docker image |
docker-run |
Build and run the Docker container |
release |
Create a release build with GoReleaser |
clean |
Remove build artifacts and generated files |
Make:
make <target>Task:
task <target>.
├── .github
│ ├── assets
│ │ ├── eui64-calculator_screenshot.png
│ │ └── eui64-calculator_social-preview_1280x640.png
│ ├── ISSUE_TEMPLATE
│ │ ├── bug_report.yaml
│ │ ├── config.yaml
│ │ └── feature_request.yaml
│ ├── renovate.json
│ └── workflows
│ ├── build.yaml
│ ├── clean-cache.yaml
│ ├── create-manifests.yaml
│ ├── deploy-gh-pages.yaml
│ ├── lint-gh.yaml
│ ├── lint-go.yaml
│ ├── pull-request.yaml
│ ├── release.yaml
│ ├── security.yaml
│ ├── test.yaml
│ └── update-go-docs.yaml
├── build
│ ├── docker
│ │ ├── .dockerignore
│ │ └── Dockerfile
│ ├── gh-pages
│ │ ├── static-gen/
│ │ ├── static/
│ │ └── wasm/
│ ├── golangci-lint
│ │ └── golangci-lint.yaml
│ └── goreleaser
│ └── goreleaser.yaml
├── cmd
│ └── server
│ ├── static
│ │ ├── favicon.ico
│ │ └── styles.css
│ ├── main.go
│ └── main_test.go
├── internal
│ ├── eui64
│ │ ├── eui64.go
│ │ └── eui64_test.go
│ ├── handlers
│ │ ├── handlers.go
│ │ └── handlers_test.go
│ ├── ui
│ │ ├── doc.go
│ │ ├── generate.go
│ │ ├── home.templ
│ │ ├── home_templ.go
│ │ ├── layout.templ
│ │ ├── layout_templ.go
│ │ ├── result.templ
│ │ ├── result_templ.go
│ │ └── ui_test.go
│ └── validators
│ ├── doc.go
│ ├── ipv6_prefix_validator.go
│ ├── ipv6_prefix_validator_test.go
│ ├── mac_validator.go
│ └── mac_validator_test.go
├── examples
│ ├── Traefik
│ │ ├── .env
│ │ ├── README.md
│ │ ├── docker-compose.yaml
│ │ └── traefik.yaml
│ └── docker-compose.yaml
├── .circleci
│ └── config.yml
├── .codacy.yml
├── .gitattributes
├── .gitignore
├── .vscode
│ └── settings.json
├── go.mod
├── go.sum
├── LICENSE
├── Makefile
├── README.md
└── Taskfile.yml
If you're using VS Code, an extensions.json file with recommended extensions is included in the .vscode directory.
Templ files (.templ) are compiled to Go via go generate. To regenerate after editing .templ files:
make generateThis runs go generate ./..., which invokes the templ CLI for all packages containing //go:generate directives.
-
Run all tests:
make test -
Run tests with the race detector:
make test-race -
Generate a coverage report:
make test-coverageThe HTML report is written to
coverage/coverage.html.
The project uses golangci-lint with a comprehensive configuration at build/golangci-lint/golangci-lint.yaml.
make lintTo format code according to the project's style rules:
make fmt-
Build the Docker image:
make docker-build -
Run the container locally:
make docker-run
- The Dockerfile uses
FROM scratchas the base image, resulting in a minimal container without a shell or other OS-level utilities. - The server defaults to port
8080. Override with thePORTenvironment variable. - Trusted reverse proxies can be configured via the
TRUSTED_PROXIESenvironment variable (comma-separated list of IP addresses).
Nicholas Fedor 💻 📖 🚧 👀 |
This was a weekend project and there's plenty of opportunity for improvement.
If you feel like contributing, please:
- Fork the repo
- Create your feature branch:
git checkout -b feature/AmazingFeature - Commit your changes:
git commit -m "Add some AmazingFeature" - Push to the branch:
git push origin feature/AmazingFeature - Open a pull request
This project is licensed under the GNU Affero General Public License.
