sio

package
v0.0.0-...-2e36be1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

sio provides functions to read and write strings, and in-band diagnostic messages on a record-oriented stream. It also includes some primitives needed by several components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dec64

func Dec64(s string) (*big.Int, error)

Dec64 decodes a buffer represented in base64, and returns it as a big.Int.

func Enc64

func Enc64(buf []byte) string

Enc64 returns a buffer encoded in base 64.

func EraseKey

func EraseKey(a []byte)

EraseKey zeroes the bytes of a key, removing it from casual memory viewing. It mattered more in Plan 9 and Inferno because allocated arrays weren't guaranteed to be zero (unless mallocz was used), and if they reused space from a key, might accidentally leak the value. It probably doesn't really matter with Go, except for archaic core files.

func HMAC

func HMAC(h func() hash.Hash, buf []byte, key []byte) []byte

HMAC applies h to buf with the given key, returning the MAC.

func ReadString

func ReadString(fd io.Reader) (string, error)

ReadString returns the next string read from fd, relying on SSL/TLS to provide a record-oriented stream, so it will read and return a complete record. By convention, a string starting "!" introduces an error message, to be returned to the caller.

func WriteError

func WriteError(fd io.Writer, s string) error

WriteError sends a diagnostic to the remote, flagged as such, and also returns it locally as an error.

func WriteString

func WriteString(f io.Writer, s string) error

WriteString writes a string to stream f, returning any error (discarding the uninteresting byte count).

Types

This section is empty.

Jump to

Keyboard shortcuts

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