decode

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// None decoding.
	None = "none"
	// Bit decoding.
	Bit = "bit"
	// Byte decoding.
	Byte = "byte"
	// Hex decoding.
	Hex = "hex"
	// Base64 decoding.
	Base64 = "base64"
	// Proto decoding.
	Proto = "proto"
)

Variables

This section is empty.

Functions

func Base10AsBytes added in v0.2.0

func Base10AsBytes(input string) ([]byte, error)

func Base2AsBytes added in v0.2.0

func Base2AsBytes(input string) ([]byte, error)

func DecodeAll

func DecodeAll(input []byte, opts ...Option) []byte

DecodeAll decodes the given input recursively as long as a decoding was applied.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder implementation.

func New

func New(opts ...Option) Decoder

New decoder with all decodings enabled by default.

func (*Decoder) Decode

func (d *Decoder) Decode(input []byte) ([]byte, Encoding)

Decode the given input as proto message, hex or base64 (applied in this order).

type Encoding

type Encoding string

Encoding handled by the decoding.

type Option

type Option func(*Decoder)

Option for decoding.

func WithBase64

func WithBase64() Option

WithBase64 decoding.

func WithBit added in v0.2.0

func WithBit() Option

WithBit decoding.

func WithByte

func WithByte() Option

WithByte decoding.

func WithHex

func WithHex() Option

WithHex decoding.

func WithProto

func WithProto() Option

WithProto decoding.

func WithoutAll

func WithoutAll() Option

WithoutAll disables all decodings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL