Files
realy/relayinfo/relayinfo.go
mleku bbebbe2b02 Add tracing with lol.Tracer in multiple functions.
Introduced `lol.Tracer` for function entry/exit logging across various packages. This improves traceability and debugging of function executions while preserving existing behavior. Removed unused files `doc.go` and `nothing.go` to clean up the repository.
2025-06-29 07:32:24 +01:00

44 lines
1.2 KiB
Go

package relayinfo
import "realy.lol/lol"
// AddSupportedNIP appends a supported NIP number to a RelayInfo.
func (ri *T) AddSupportedNIP(n int) {
lol.Tracer("AddSupportedNIP", n)
defer func() { lol.Tracer("end AddSupportedNIP") }()
idx, exists := ri.Nips.HasNumber(n)
if exists {
return
}
ri.Nips = append(ri.Nips, -1)
copy(ri.Nips[idx+1:], ri.Nips[idx:])
ri.Nips[idx] = n
}
// Admission is the cost of opening an account with a relay.
type Admission struct {
Amount int `json:"amount"`
Unit string `json:"unit"`
}
// Subscription is the cost of keeping an account open for a specified period of time.
type Subscription struct {
Amount int `json:"amount"`
Unit string `json:"unit"`
Period int `json:"period"`
}
// Publication is the cost and restrictions on storing events on a relay.
type Publication []struct {
Kinds []int `json:"kinds"`
Amount int `json:"amount"`
Unit string `json:"unit"`
}
// Fees defines the fee structure used for a paid relay.
type Fees struct {
Admission []Admission `json:"admission,omitempty"`
Subscription []Subscription `json:"subscription,omitempty"`
Publication []Publication `json:"publication,omitempty"`
}