mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-05 04:54:31 +02:00
feat(nip11): update to nips pr nostr-protocol/nip#1821
This commit is contained in:
@ -45,12 +45,14 @@ func (info *RelayInformationDocument) AddSupportedNIPs(numbers []int) {
|
|||||||
type RelayLimitationDocument struct {
|
type RelayLimitationDocument struct {
|
||||||
MaxMessageLength int `json:"max_message_length,omitempty"`
|
MaxMessageLength int `json:"max_message_length,omitempty"`
|
||||||
MaxSubscriptions int `json:"max_subscriptions,omitempty"`
|
MaxSubscriptions int `json:"max_subscriptions,omitempty"`
|
||||||
MaxFilters int `json:"max_filters,omitempty"`
|
|
||||||
MaxLimit int `json:"max_limit,omitempty"`
|
MaxLimit int `json:"max_limit,omitempty"`
|
||||||
|
DefaultLimit int `json:"default_limit,omitempty"`
|
||||||
MaxSubidLength int `json:"max_subid_length,omitempty"`
|
MaxSubidLength int `json:"max_subid_length,omitempty"`
|
||||||
MaxEventTags int `json:"max_event_tags,omitempty"`
|
MaxEventTags int `json:"max_event_tags,omitempty"`
|
||||||
MaxContentLength int `json:"max_content_length,omitempty"`
|
MaxContentLength int `json:"max_content_length,omitempty"`
|
||||||
MinPowDifficulty int `json:"min_pow_difficulty,omitempty"`
|
MinPowDifficulty int `json:"min_pow_difficulty,omitempty"`
|
||||||
|
CreatedAtLowerLimit int64 `json:"created_at_lower_limit"`
|
||||||
|
CreatedAtUpperLimit int64 `json:"created_at_upper_limit"`
|
||||||
AuthRequired bool `json:"auth_required"`
|
AuthRequired bool `json:"auth_required"`
|
||||||
PaymentRequired bool `json:"payment_required"`
|
PaymentRequired bool `json:"payment_required"`
|
||||||
RestrictedWrites bool `json:"restricted_writes"`
|
RestrictedWrites bool `json:"restricted_writes"`
|
||||||
|
@ -67,7 +67,7 @@ func (c *Client) DownloadToFile(ctx context.Context, hash string, filePath strin
|
|||||||
return fmt.Errorf("%s is not present in %s: %d", hash, c.mediaserver, resp.StatusCode)
|
return fmt.Errorf("%s is not present in %s: %d", hash, c.mediaserver, resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create file %s for %s: %w", filePath, hash, err)
|
return fmt.Errorf("failed to create file %s for %s: %w", filePath, hash, err)
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ type Store struct {
|
|||||||
|
|
||||||
func NewStore(path string) (*Store, error) {
|
func NewStore(path string) (*Store, error) {
|
||||||
// create directory if it doesn't exist
|
// create directory if it doesn't exist
|
||||||
if err := os.MkdirAll(path, 0755); err != nil {
|
if err := os.MkdirAll(path, 0o755); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ func NewStore(path string) (*Store, error) {
|
|||||||
env.SetMapSize(1 << 30) // 1GB
|
env.SetMapSize(1 << 30) // 1GB
|
||||||
|
|
||||||
// open the environment
|
// open the environment
|
||||||
if err := env.Open(path, lmdb.NoTLS|lmdb.WriteMap, 0644); err != nil {
|
if err := env.Open(path, lmdb.NoTLS|lmdb.WriteMap, 0o644); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user