mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-22 08:37:13 +00:00
33 lines
603 B
Go
33 lines
603 B
Go
package web
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
type RelayMetadata struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Pubkey string `json:"pubkey"`
|
|
Contact string `json:"contact"`
|
|
SupportedNIPs []int `json:"supported_nips"`
|
|
Software string `json:"software"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
var relayMetadata RelayMetadata
|
|
|
|
func LoadRelayMetadata(filename string) error {
|
|
data, err := os.ReadFile(filename)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = json.Unmarshal(data, &relayMetadata)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|