diff options
author | Florian Klink <flokli@flokli.de> | 2023-10-03T11·49+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-10-05T06·17+0000 |
commit | 28d1b9c01d009424eed276f5689430897afd97ec (patch) | |
tree | 529a924d5ca585db419cff4d5f9e64824fa8416b /tvix/nar-bridge/pkg/server/util.go | |
parent | 0353108e99c6c2b7f15ea0c99a8ca4fd899d241a (diff) |
refactor(tvix/nar-bridge): move pkg/server to pkg/http r/6700
This is only dealing with the HTTP interface. Change-Id: I011b624fd9f11ea96231b92fea1166c118a219f2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9535 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/nar-bridge/pkg/server/util.go')
-rw-r--r-- | tvix/nar-bridge/pkg/server/util.go | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/tvix/nar-bridge/pkg/server/util.go b/tvix/nar-bridge/pkg/server/util.go deleted file mode 100644 index 47e368adde80..000000000000 --- a/tvix/nar-bridge/pkg/server/util.go +++ /dev/null @@ -1,24 +0,0 @@ -package server - -import ( - "fmt" - nixhash "github.com/nix-community/go-nix/pkg/hash" -) - -// parseNarHashFromUrl parses a nixbase32 string representing a sha256 NarHash -// and returns a nixhash.Hash when it was able to parse, or an error. -func parseNarHashFromUrl(narHashFromUrl string) (*nixhash.Hash, error) { - // peek at the length. If it's 52 characters, assume sha256, - // if it's something else, this is an error. - l := len(narHashFromUrl) - if l != 52 { - return nil, fmt.Errorf("invalid length of narHash: %v", l) - } - - nixHash, err := nixhash.ParseNixBase32("sha256:" + narHashFromUrl) - if err != nil { - return nil, fmt.Errorf("unable to parse nixbase32 hash: %w", err) - } - - return nixHash, nil -} |