diff --git a/pkgs/by-name/hy/hyprspace/config_generated.go b/pkgs/by-name/hy/hyprspace/config_generated.go index 1578bd9d50fd..8da04a859018 100644 --- a/pkgs/by-name/hy/hyprspace/config_generated.go +++ b/pkgs/by-name/hy/hyprspace/config_generated.go @@ -36,9 +36,9 @@ type ConfigPeersElemRoutesElem struct { } // UnmarshalJSON implements json.Unmarshaler. -func (j *ConfigPeersElemRoutesElem) UnmarshalJSON(b []byte) error { +func (j *ConfigPeersElemRoutesElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { + if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["net"]; raw != nil && !ok { @@ -46,7 +46,7 @@ func (j *ConfigPeersElemRoutesElem) UnmarshalJSON(b []byte) error { } type Plain ConfigPeersElemRoutesElem var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { + if err := json.Unmarshal(value, &plain); err != nil { return err } *j = ConfigPeersElemRoutesElem(plain) @@ -54,9 +54,9 @@ func (j *ConfigPeersElemRoutesElem) UnmarshalJSON(b []byte) error { } // UnmarshalJSON implements json.Unmarshaler. -func (j *ConfigPeersElem) UnmarshalJSON(b []byte) error { +func (j *ConfigPeersElem) UnmarshalJSON(value []byte) error { var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { + if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["id"]; raw != nil && !ok { @@ -64,7 +64,7 @@ func (j *ConfigPeersElem) UnmarshalJSON(b []byte) error { } type Plain ConfigPeersElem var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { + if err := json.Unmarshal(value, &plain); err != nil { return err } if v, ok := raw["name"]; !ok || v == nil { @@ -78,12 +78,53 @@ func (j *ConfigPeersElem) UnmarshalJSON(b []byte) error { } // The services this node provides via the Service Network. -type ConfigServices map[string]string +type ConfigServices map[string]struct { + // Acl corresponds to the JSON schema field "acl". + Acl *ConfigServicesValueAcl `json:"acl,omitempty"` + + // Target address. + Target string `json:"target"` +} + +type ConfigServicesValueAcl struct { + // List of peers that are explicitly not allowed to connect. + Blacklist []string `json:"blacklist,omitempty"` + + // Whether to enable whitelist enforcement. + EnableWhitelist bool `json:"enableWhitelist,omitempty"` + + // List of peers that are allowed to connect. + Whitelist []string `json:"whitelist,omitempty"` +} // UnmarshalJSON implements json.Unmarshaler. -func (j *Config) UnmarshalJSON(b []byte) error { +func (j *ConfigServicesValueAcl) UnmarshalJSON(value []byte) error { var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { + if err := json.Unmarshal(value, &raw); err != nil { + return err + } + type Plain ConfigServicesValueAcl + var plain Plain + if err := json.Unmarshal(value, &plain); err != nil { + return err + } + if v, ok := raw["blacklist"]; !ok || v == nil { + plain.Blacklist = []string{} + } + if v, ok := raw["enableWhitelist"]; !ok || v == nil { + plain.EnableWhitelist = false + } + if v, ok := raw["whitelist"]; !ok || v == nil { + plain.Whitelist = []string{} + } + *j = ConfigServicesValueAcl(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Config) UnmarshalJSON(value []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(value, &raw); err != nil { return err } if _, ok := raw["privateKey"]; raw != nil && !ok { @@ -91,7 +132,7 @@ func (j *Config) UnmarshalJSON(b []byte) error { } type Plain Config var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { + if err := json.Unmarshal(value, &plain); err != nil { return err } if v, ok := raw["listenAddresses"]; !ok || v == nil { @@ -106,7 +147,7 @@ func (j *Config) UnmarshalJSON(b []byte) error { plain.Peers = []ConfigPeersElem{} } if v, ok := raw["services"]; !ok || v == nil { - plain.Services = map[string]string{} + plain.Services = ConfigServices{} } *j = Config(plain) return nil diff --git a/pkgs/by-name/hy/hyprspace/package.nix b/pkgs/by-name/hy/hyprspace/package.nix index 9444accc3d12..efefaeb3bc27 100644 --- a/pkgs/by-name/hy/hyprspace/package.nix +++ b/pkgs/by-name/hy/hyprspace/package.nix @@ -9,13 +9,13 @@ buildGoModule (finalAttrs: { pname = "hyprspace"; - version = "0.12.0"; + version = "0.13.1"; src = fetchFromGitHub { owner = "hyprspace"; repo = "hyprspace"; tag = "v${finalAttrs.version}"; - hash = "sha256-VOufAPhCbLzVxrj/XKwunJkxUx0EAovV4+adrQLwcoI="; + hash = "sha256-AsOgnnYZRoB/t2XwrTMD8XIHoy/bl6bqUvIT5e02uNo="; }; env.CGO_ENABLED = "0";