diff options
| author | Franck Cuny <franck@fcuny.net> | 2022-06-18 14:10:23 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2022-06-18 14:18:02 -0700 |
| commit | 300eb227b160f05d7aa429e9c779f2c74e095f81 (patch) | |
| tree | 8b0ea3e46f6d259969aef51eec2e20d385fecfa7 /tools/ipconverter/default.nix | |
| parent | ref(scripts): remove the module for scripts (diff) | |
| download | infra-300eb227b160f05d7aa429e9c779f2c74e095f81.tar.gz | |
feat(ipconverter): add a tool to convert IPv4 to int and vice-versa
It's sometimes useful to store IPv4 addresses as an integer. This tool
helps with the conversion, and also does the reverse conversion.
```
% go run . int2ip 3232235521
3232235521 192.168.0.1
% go run . ip2int 192.168.0.1
192.168.0.1 3232235521
```
Change-Id: Ic1e44057bca3539b4c183d387c635f69f5bf3f36
Reviewed-on: https://cl.fcuny.net/c/world/+/441
Tested-by: CI
Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to 'tools/ipconverter/default.nix')
| -rw-r--r-- | tools/ipconverter/default.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/ipconverter/default.nix b/tools/ipconverter/default.nix new file mode 100644 index 0000000..3be25fc --- /dev/null +++ b/tools/ipconverter/default.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +pkgs.buildGoModule rec { + name = "ipconverter"; + src = ./.; + vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; + nativeBuildInputs = with pkgs; [ go ]; + + meta = with pkgs.lib; { + description = "CLI to convert IP addresses to integer and vice versa"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = [ ]; + }; +} |
