Documentation ¶
Index ¶
- Variables
- func AddressScript(address string, params *chaincfg.Params) ([]byte, error)
- func CheckMp4Codec(path string) (bool, error)
- func ContentTypeForPath(path string) (*constants.Media, error)
- func DisableTls(rpcConnect, port string) (bool, error)
- func IsNullOutpoint(point wire.OutPoint) bool
- func IsNullOutpointString(output string) (bool, error)
- func IsUnBoundOutpointString(output string) (bool, error)
- func NullOutpoint() *wire.OutPoint
- func NumberFormat(str string) string
- func RegisterProtocol(p Protocol)
- type AcceptEncoding
- type CBRC20
- type DefaultProtocol
- type Peek
- type Peekable
- type Protocol
- type Reader
Constants ¶
This section is empty.
Variables ¶
var ActiveNet = &netparams.MainNetParams
var ErrNotSlice = errors.New("not slice")
ErrNotSlice is an error that is returned when the provided value is not a slice.
var ErrSliceValueCannotInterface = errors.New("slice value cannot interface")
ErrSliceValueCannotInterface is an error that is returned when the slice value cannot be converted to an interface.
var NotSupportedProtocol = errors.New("not supported protocol")
NotSupportedProtocol is an error that represents a not supported protocol.
Functions ¶
func AddressScript ¶
AddressScript is a function that converts a given address to a script. It first decodes the address, then generates a pay-to-address script from the decoded address. It returns the generated script and any error that occurred during the process.
func CheckMp4Codec ¶
CheckMp4Codec is a function that takes a file path as input and returns a boolean indicating whether the file's codec is h264 and an error. It first opens the file and gets the streams. It then checks each stream to see if it's a video stream and if the codec is h264. If the stream is not a video stream or the codec is not h264, it returns false. If all streams are video streams and the codec is h264, it returns true.
func ContentTypeForPath ¶
ContentTypeForPath is a function that takes a file path as input and returns the media type of the file and an error. It first checks the file extension and if it's mp4, it checks the codec of the file. If the codec is not h264, it returns an error. If the file extension is found in the list of supported media types, it returns the media type. If the file extension is not supported, it returns an error.
func DisableTls ¶
func IsNullOutpoint ¶
func IsNullOutpointString ¶
func IsUnBoundOutpointString ¶
func NullOutpoint ¶
func NumberFormat ¶
func RegisterProtocol ¶
func RegisterProtocol(p Protocol)
RegisterProtocol is a function that registers a protocol.
Types ¶
type AcceptEncoding ¶
type AcceptEncoding struct {
// contains filtered or unexported fields
}
func ParseAcceptEncoding ¶
func ParseAcceptEncoding(acceptEncoding string) *AcceptEncoding
func (*AcceptEncoding) IsAccept ¶
func (a *AcceptEncoding) IsAccept(encoding string) bool
type CBRC20 ¶
type CBRC20 struct { DefaultProtocol Protocol string `json:"p"` Operation string `json:"op"` Tick string `json:"tick"` Max string `json:"max,omitempty"` // deploy Limit string `json:"lim,omitempty"` Decimals string `json:"dec,omitempty"` }
CBRC20 is a struct that represents a BRC20C protocol. It contains the protocol name, operation, tick, max, limit, decimals, tkId, amount, and to.
func (*CBRC20) Check ¶
Check is a method of the BRC20C struct. It checks the BRC20C protocol. It unmarshals the data into a new BRC20C struct and checks the protocol name, tick name, and operation. If the operation is "deploy", it checks the max, limit, and decimals. If the operation is "mint", it checks the tkId. If the operation is not supported, it returns an error.
type DefaultProtocol ¶
type DefaultProtocol struct { Reader // contains filtered or unexported fields }
DefaultProtocol is a struct that represents a default protocol. It embeds the Reader struct.
func (*DefaultProtocol) Check ¶
func (d *DefaultProtocol) Check() error
Check is a method of the DefaultProtocol struct. It checks the DefaultProtocol. Currently, it does not perform any operations and always returns nil.
func (*DefaultProtocol) Clone ¶
func (d *DefaultProtocol) Clone() Protocol
Clone returns a new DefaultProtocol.
func (*DefaultProtocol) Name ¶
func (d *DefaultProtocol) Name() string
Name is a method of the DefaultProtocol struct. It returns the name of the DefaultProtocol.
type Peek ¶
type Peek struct {
// contains filtered or unexported fields
}
Peek is a struct that implements the Peekable interface. It contains a slice and an index for iteration.
func (*Peek) Next ¶
func (p *Peek) Next() interface{}
Next returns the current element and moves the iterator to the next element.
type Peekable ¶
type Peekable interface { Peek() interface{} // Peek returns the current element in the slice without moving the iterator. Next() interface{} // Next returns the current element and moves the iterator to the next element. HasNext() bool // HasNext checks if there are more elements in the slice. Range(fn func(int, interface{}) error) error // Range iterates over the slice and calls the provided function for each element. }
Peekable is an interface that defines methods for peeking and iterating over a slice.
func NewPeekable ¶
NewPeekable creates a new Peekable from a slice or a pointer to a slice. It returns an error if the provided value is not a slice or if the slice values cannot be converted to an interface.
type Protocol ¶
type Protocol interface { Name() string Check() error Reset([]byte) Len() int Clone() Protocol Chunks(size uint64) ([]byte, error) }
Protocol is an interface that defines the methods that a protocol should implement. It includes methods for getting the name of the protocol, checking the protocol, getting the length of the protocol, and getting the chunks of the protocol.
func NewProtocolFromBytes ¶
NewProtocolFromBytes is a function that returns a new protocol from bytes.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a struct that represents a reader. It contains the data to be read and a bytes.Reader to read the data.
func (*Reader) Chunks ¶
Chunks is a method of the Reader struct. It returns the chunks of the data of the Reader.