txtutil

package
v4.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeQuoted added in v4.7.0

func EncodeQuoted(t string) string

EncodeQuoted encodes a string into a series of quoted 255-octet chunks. That is, when decoded each chunk would be 255-octets with the remainder in the last chunk.

The output looks like:

`""`                                      empty
`"255\"octets"`                           quotes are escaped
`"255\\octets"`                           backslashes are escaped
`"255octets" "255octets" "remainder"`     long strings are chunked

func ParseQuoted added in v4.7.0

func ParseQuoted(s string) (string, error)

ParseQuoted parses a string of RFC1035-style quoted items. The resulting items are then joined into one string. This is useful for parsing TXT records. Examples: `foo` => foo `"foo"` => foo `"f\"oo"` => f"oo `"f\\oo"` => f\oo `"foo" "bar"` => foobar `"foo" bar` => foobar

func Segment added in v4.6.1

func Segment(s string) []string

Segment returns the string as 255-octet segments, the last being the remainder.

func SplitSingleLongTxt

func SplitSingleLongTxt(records any)

SplitSingleLongTxt does nothing. Deprecated: This is a no-op for backwards compatibility.

func ToChunks added in v4.7.0

func ToChunks(s string) []string

ToChunks returns the string as chunks of 255-octet strings (the last string being the remainder).

Types

type State added in v4.7.0

type State int
const (
	StateStart     State = iota // Looking for a non-space
	StateUnquoted               // A run of unquoted text
	StateQuoted                 // Quoted text
	StateBackslash              // last char was backlash in a quoted string
	StateWantSpace              // expect space after closing quote
)

Jump to

Keyboard shortcuts

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