A EUI-64 address calculator implemented in Go, HTMX, and Templ.
This project was inspired by ThePrincelle's EUI64-Calculator
This project provides a simple tool for calculating an EUI-64 IPv6 address using a MAC addresses and IPv6 Prefix.
π A static version of this project is now available at https://eui64-calculator.nickfedor.com π
- EUI-64 Calculation: Convert a 48-bit MAC address into a 64-bit EUI-64 format.
- IPv6 Address Generation: Combine the EUI-64 with a user-provided IPv6 prefix.
- Web Interface: User-friendly interface for input and result display using HTMX for dynamic content loading.
- Docker Support: Containerized deployment for easy setup and scalability.
- Enter a MAC Address in the format
xx-xx-xx-xx-xx-xx
. - Enter an IPv6 Prefix.
- Click
Calculate
to see the results.
docker run -d --name eui64-calculator nickfedor/eui64-calculator:latest
-
Running the Basic Template:
docker compose -f ./Docker/compose.yaml up -d
-
Traefik Reverse Proxy example
- Go: https://go.dev/doc/install
- Templ:
go install github.com/a-h/templ/cmd/templ@latest
-
Clone the repository:
git clone https://github.com/nicholas-fedor/eui64-calculator.git
-
Enter the repository:
cd eui64-calculator
-
Install Dependencies:
go mod download
-
Generate Templates:
templ generate
-
Run the Server:
go run ./cmd/server/main.go
-
The application will be accessible at http://localhost:8080/
.
βββ .github
β βββ workflows
β β βββ create-manifests.yaml
β β βββ lint-go.yaml
β β βββ build.yaml
β β βββ clean-cache.yaml
β β βββ pull-request.yaml
β β βββ release.yaml
β β βββ security.yaml
β β βββ test.yaml
β βββ ISSUE_TEMPLATE
β β βββ bug_report.yaml
β β βββ config.yaml
β β βββ feature_request.yaml
β βββ assets
β β βββ eui64-calculator_screenshot.png
β β βββ eui64-calculator_social-preview_1280x640.png
β βββ renovate.json
βββ build
β βββ docker
β β βββ Dockerfile
β β βββ .dockerignore
β βββ golangci-lint
β β βββ golangci.yaml
β βββ goreleaser
β βββ goreleaser.yaml
βββ cmd
β βββ server
β βββ static
β β βββ favicon.ico
β β βββ styles.css
β βββ main.go
β βββ main_test.go
βββ internal
β βββ ui
β β βββ doc.go
β β βββ generate.go
β β βββ home.templ
β β βββ layout.templ
β β βββ result.templ
β β βββ ui_test.go
β βββ eui64
β β βββ eui64.go
β β βββ eui64_test.go
β βββ handlers
β β βββ handlers.go
β β βββ handlers_test.go
β βββ validators
β βββ ipv6_prefix_validator.go
β βββ ipv6_prefix_validator_test.go
β βββ mac_validator.go
β βββ mac_validator_test.go
βββ .all-contributorsrc
βββ .circleci
β βββ config.yml
βββ .codacy.yml
βββ .gitattributes
βββ .gitignore
βββ LICENSE
βββ README.md
βββ examples
β βββ Traefik
β β βββ .env
β β βββ README.md
β β βββ docker-compose.yaml
β β βββ traefik.yaml
β βββ docker-compose.yaml
βββ go.mod
βββ go.sum
- Golang: https://go.dev/doc
- gin-gonic/gin: https://github.com/gin-gonic/gin
- Templ: https://github.com/a-h/templ
- HTMX: https://htmx.org/docs
If you're using VSCode, I've included an extensions.json
file with recommended extensions.
-
Installing the Templ CLI
go install github.com/a-h/templ/cmd/templ@latest
-
Rebuilding
.templ.go
files after updates to.templ
files (run from the project's root directory)Linux:
rm ./ui/*_templ.go && templ generate
Windows:
del ui\*_templ.go && templ generate
-
Unit Tests:
go test ./...
-
Docker Test Stage:
The Dockerfile includes a test stage to ensure all tests pass before building the production image.
-
Rebuilding the Docker image:
docker build -f docker/Dockerfile-dev -t eui64-calculator-dev .
-
Running the image locally:
docker run -it -p 8080:8080 eui64-calculator-dev
-
The Dockerfile uses
gcr.io/distroless/static-debian12
as the final runtime image for the application. This results in a minimal container image without a shell or other features typical of other container images. -
I opted to hardcode Gin's release mode to avoid redundant environment variables. This can be easily commented out in the
cmd/server/main.go
file.
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 GPLv3 license - see the LICENSE file for details.