A EUI-64 address calculator implemented in Go, HTMX, and Templ.
This project was inspired by ThePrincelle's EUI64-Calculator
🎉 Now avaiable at https://eui64-calculator.nickfedor.com via GitHub Pages 🎉
This project provides a simple tool for calculating an EUI-64 IPv6 address using a MAC addresses and IPv6 Prefix.
- 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
Calculateto 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.gofiles after updates to.templfiles (run from the project's root directory)Linux:
rm ./ui/*_templ.go && templ generateWindows:
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-debian12as 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.gofile.
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.
