parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package parser contains functions that assist with parsing a wireguard-go ipc response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseInt

func ParseInt[N constraints.Signed](b []byte) (N, error)

func ParseUint

func ParseUint[N constraints.Unsigned](b []byte) (N, error)

func ScanLines

func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)

ScanLines is a split function for a Scanner that returns each line of text, stripped of any trailing end-of-line marker. The returned line may NOT be empty. The end-of-line marker is NO carriage return followed by one mandatory newline. In regular expression notation, it is `\n`. The last non-empty line of input will ONLY be returned even if it HAS A newline.

This is modified from the function in bufio.ScanLines, with the difference being that it requires lines to end with a newline.

Types

type IPCKeyValue

type IPCKeyValue = internal.KeyValue

func ParseConstant

func ParseConstant(str string, b []byte, v IPCKeyValue) (IPCKeyValue, error)

func ParseIPNet

func ParseIPNet[K fmt.Stringer](b []byte) (IPCKeyValue, error)

func ParseInt64

func ParseInt64[K fmt.Stringer](b []byte) (IPCKeyValue, error)

func ParseKey

func ParseKey[K fmt.Stringer, T wgkey.Type](b []byte) (IPCKeyValue, error)

ParseKey parses a key in hex string format.

func ParseOne

func ParseOne[K fmt.Stringer](b []byte) (IPCKeyValue, error)

func ParseTrue

func ParseTrue[K fmt.Stringer](b []byte) (IPCKeyValue, error)

func ParseUDPAddr

func ParseUDPAddr[K fmt.Stringer](b []byte) (IPCKeyValue, error)

ParseUDPAddr parses an address using net.ResolveUDPAddr.

func ParseUint16

func ParseUint16[K fmt.Stringer](b []byte) (IPCKeyValue, error)

func ParseUint32

func ParseUint32[K fmt.Stringer](b []byte) (IPCKeyValue, error)

func ParseUint64

func ParseUint64[K fmt.Stringer](b []byte) (IPCKeyValue, error)

Jump to

Keyboard shortcuts

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