Documentation ¶
Index ¶
- Constants
- Variables
- func Any(b ...bool) bool
- func Context(purpose string) string
- func DecodeBase64(arr []byte) chan []byte
- func DecodeHex(src []byte) chan []byte
- func DeriveCA(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
- func Empty(arr []byte) chan []byte
- func EncodeBase64(arr []byte) chan []byte
- func EncodeHex(src []byte) chan []byte
- func Even(i uint64) uint64
- func Expand(k []byte, toSize int) []byte
- func F_ALL(s *Set) bool
- func F_LSB0(s *Set) bool
- func F_MSB0(s *Set) bool
- func FmtLetsEncrypt(domain string) (string, string)
- func GetMajor() (int, error)
- func GetMinor() (int, error)
- func Ham(t0, t1 []byte) int
- func MaxEq(x, y int) int
- func MaxR() []byte
- func MinEq(x, y int) int
- func NewCName(commonName string) pkix.Name
- func NewCsr(sk ed25519.PrivateKey, name pkix.Name) (*x509.CertificateRequest, error)
- func NewEndEntityCert(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
- func NewName(commonName, country, org string) pkix.Name
- func Nor(err error) bool
- func Outln(ifces ...interface{}) error
- func Outlnh(ifces ...interface{}) error
- func Outlnp(ifces ...interface{}) error
- func ParseURI(u *url.URL) map[string]string
- func PemDecodeCRL(rawPemBytes []byte) (*pkix.CertificateList, error)
- func PemDecodeCRT(rawCRT []byte) (*x509.Certificate, error)
- func PemDecodeCSR(rawCSR []byte) (*x509.CertificateRequest, error)
- func PemEncodeCRL(rawCRL []byte) []byte
- func PemEncodeCRT(rawCRT []byte) []byte
- func PemEncodeCSR(rawCSR []byte) []byte
- func R(n int) *big.Int
- func Rb() uint
- func RedirectServer() *http.Server
- func Ri(n *big.Int) *big.Int
- func Rp(s int) *big.Int
- func Rpb(s int) []byte
- func SelfSignedCA(sk ed25519.PrivateKey, req *x509.CertificateRequest) (*x509.Certificate, error)
- func Sock(at string, with []byte) error
- func Split(k []byte, p int) ([][]byte, int)
- func Sum(x []byte) int
- func ToBase(raw []byte, base int) []byte
- func TransformRange(value, xMin, xMax, nMin, nMax float64) float64
- func XorK(x []byte, k byte) []byte
- func XorY(x, y []byte) []byte
- type Alg
- type Bit
- type Bitflag
- type DirectoryGraph
- type EncodingSet
- type ExtToFileNode
- type FileExtension
- type FileNode
- type FlagToEncodingSet
- type LClient
- func (c *LClient) Decrypt(dst, src *bytes.Buffer) (*bytes.Buffer, error)
- func (c *LClient) Encrypt(dst, src *bytes.Buffer) (*bytes.Buffer, error)
- func (c *LClient) FmtRequest(endpoint ValidEndpoint, args ...string) *bytes.Buffer
- func (c *LClient) Get(key string) ([]byte, error)
- func (c *LClient) GetKey() ([]byte, error)
- func (c *LClient) GetServerKey() (*age.X25519Recipient, error)
- func (c *LClient) Home() ([]byte, error)
- func (c *LClient) Set(key, val string) ([]byte, error)
- func (c *LClient) SetKey() ([]byte, error)
- type Linker
- type Set
- func (set *Set) Base(base int) []byte
- func (s *Set) Bitsize() int
- func (s *Set) Buffer() *bytes.Buffer
- func (s *Set) Bytes() []byte
- func (s *Set) Bytesize() int
- func (s *Set) Clear() *Set
- func (set *Set) Eq(x *Set) bool
- func (s *Set) Expand(to []byte) []byte
- func (set *Set) Flipflop() *Set
- func (s *Set) Gt(set *Set) bool
- func (s *Set) Ham(set *Set) *Set
- func (s *Set) LShift() *Set
- func (set *Set) Lsb() Bit
- func (set *Set) Lsbs(last uint) []Bit
- func (s *Set) Lt(set *Set) bool
- func (s *Set) MaxEq(set *Set) *Set
- func (s *Set) MinEq(set *Set) *Set
- func (set *Set) Msb() Bit
- func (set *Set) Msbs(last uint) []Bit
- func (s *Set) Out()
- func (s *Set) Permutate() *Universe
- func (s *Set) Permute(bit int) (*Set, *Set, *Set)
- func (s *Set) RShift() *Set
- func (s *Set) Reader() *bytes.Reader
- func (s *Set) Scanner() *bufio.Scanner
- func (s *Set) Set(buff []byte) *Set
- func (s *Set) Split() (*Set, *Set)
- func (s *Set) String() string
- func (s *Set) Sum() *Set
- func (s *Set) T(t Transform) *Set
- func (s *Set) Weight() *Set
- func (s *Set) Write(f *os.File) (int, error)
- func (s *Set) WriteAs(base int, f *os.File) (int, error)
- func (s *Set) Xor(set *Set) *Set
- type SysInfo
- type Transform
- type Tsec
- type Universe
- func DecodePEM(raw []byte) (*Universe, error)
- func DecodePEMFile(path string) (*Universe, error)
- func PointDistribution(bits int) *Universe
- func Uniform(N int64) *Universe
- func UniformByExp(N, S int64) *Universe
- func UniformByPow(N, S int64) *Universe
- func UniformDistribution(N int64) *Universe
- func UniformDistributionRp(N int64, Z int) *Universe
- func UniformFrom(bytes ...[]byte) *Universe
- func UniformOfPrimes(N, S int64) *Universe
- func UniformOver(sets ...*Set) *Universe
- func UniformRange(n, N int64) *Universe
- func (u *Universe) Add(y *Set) *Universe
- func (u *Universe) Apply(t func(*Set, *Set) *Set, z *Set) *Universe
- func (u *Universe) Bdp() int
- func (u *Universe) Collect() map[string]int
- func (u *Universe) Div(y *Set) *Universe
- func (u *Universe) EncodePEM() []byte
- func (u *Universe) Expand() *Universe
- func (u *Universe) Factorial() *Set
- func (u *Universe) Filter(f func(s *Set) bool) *Universe
- func (u *Universe) Headers() map[string]string
- func (u *Universe) Insert(sets ...*Set) *Universe
- func (u *Universe) Intersection(U *Universe) *Universe
- func (u *Universe) Inverse(f func(s *Set) bool) *Universe
- func (u *Universe) Join(together ...*Universe) *Universe
- func (u *Universe) Mul(y *Set) *Universe
- func (u *Universe) P() float64
- func (u *Universe) Push(set *Set) *Universe
- func (u *Universe) Sample() *Set
- func (u *Universe) Size() int
- func (u *Universe) SizeF() float64
- func (u *Universe) Slice(f func(s *Set) bool) (*Universe, *Universe)
- func (u *Universe) Sqrt() float64
- func (u *Universe) Sum() *Set
- func (u *Universe) Union(U *Universe) *Universe
- func (u *Universe) Write(f *os.File, base int)
- func (u *Universe) WritePEM(f *os.File) (int, error)
- func (u *Universe) Xor(y *Set) *Universe
- type ValidEndpoint
Constants ¶
const ( BitFlagUse string = "bf" BitFlagShort string = "interact with bitflags" BitFlagAlias0, BitFlagAlias1, BitFlagAlias2, BitFlagAlias3 string = "bflag", "bflags", "bit-flag", "bit-flags" )
For cli interface
const ( // uint8 values for 0, 1. Zero Bit = 48 + iota One // the probability to be distributed across the Sets of U. Probility float64 = 1.0 )
const ( Application string = "" Library string = "1ofi/lib" )
The version is embeded into the library, stored in the following local structure A bash CLI exists for modifying this same structure https://git.sr.ht/~johns/tag
.tag ├── .tag/MNOR ├── .tag/MVAR ├── .tag/RLSE
Variables ¶
var ( ErrNotPEMEncoded = errors.New("invalid: Not PEM Encoded") ErrExcessInput = errors.New("invalid: Excess") ErrUnknownHeader = errors.New("invalid: Unknown Header Type") ErrUnknownHash = errors.New("invalid: Unknown Hash Type") ErrInvalidHeader = errors.New("invalid: PEM Header") ErrMismatchedVersion = errors.New("invalid: Mismatched Version") ErrFutureTimestamp = errors.New("invalid: Timestamp in the future") )
Errors potentially returned from PEM decoding.
var (
ErrServerPublicKey = errors.New("client: could not get serverkey")
)
var Major string
var Minor string
var Release string
We accept that release values may have arbitrary strings concatinated to the end of it and do not parse it to an integer.
var Version string
This is constructed from the embedded version tag
Functions ¶
func DecodeBase64 ¶
func DeriveCA ¶
func DeriveCA(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
returns a new certificate authority issued from a parent x509 certificate
func EncodeBase64 ¶
func F_ALL ¶
Filter that guarentees all Sets of U. to have a filter that guarentees no sets use Inverse(F_ALL).
func F_LSB0 ¶
Filters for all Sets where the least significant bit == 0. To filter the set of Sets where lsb == 1 use Inverse(F_LSB0).
func F_MSB0 ¶
Filters for all sets where the most significant bit == 0. To filter the set of Sets where msb == 1 use Inverse(F_MSB0).
func FmtLetsEncrypt ¶
func NewCsr ¶
func NewCsr(sk ed25519.PrivateKey, name pkix.Name) (*x509.CertificateRequest, error)
creates a new certificate signing request for a
func NewEndEntityCert ¶
func NewEndEntityCert(sk ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate) (*x509.Certificate, error)
issues a new certificate from a parent certificate authority
func PemDecodeCRL ¶
func PemDecodeCRL(rawPemBytes []byte) (*pkix.CertificateList, error)
der encodes a pem encoded crl
func PemDecodeCRT ¶
func PemDecodeCRT(rawCRT []byte) (*x509.Certificate, error)
der encodes a pem encoded crt
func PemDecodeCSR ¶
func PemDecodeCSR(rawCSR []byte) (*x509.CertificateRequest, error)
pem encodes a der encoded csr
func RedirectServer ¶
func SelfSignedCA ¶
func SelfSignedCA(sk ed25519.PrivateKey, req *x509.CertificateRequest) (*x509.Certificate, error)
returns a new self-signed certificate
func Split ¶
Splits a k sized byte array p pieces. Returns the sliced array of arrays and the amount of spillover.
func TransformRange ¶
performs a linear transform on value from a known xMin, xMax to the new range nMin, nMax
Types ¶
type DirectoryGraph ¶
type DirectoryGraph struct { // at creation Node is the serialized FileNode at path Node *ring.Ring // contains filtered or unexported fields }
func NewDirectoryGraph ¶
func NewDirectoryGraph(root string) DirectoryGraph
Creates a new directory graph, all subdirectories of root are recursively traversed when this function is called
func NewGraphRing ¶
func NewGraphRing(roots ...string) DirectoryGraph
Creates an array of new directory graphs and links them into one ring
func (DirectoryGraph) FilterFor ¶
func (e DirectoryGraph) FilterFor(exts ...FileExtension) ExtToFileNode
filters the DirectoryGraph using the FileExtensions (keys) of extMap for each extension we populate an array of all FileNode using that extension
func (DirectoryGraph) Flatten ¶ added in v0.0.12
func (e DirectoryGraph) Flatten() []*FileNode
Returns an array of FileNodes. The results were serialized when the DirectoryGraph were created' therefore this struct may contain stale data.
func (DirectoryGraph) InvertByExt ¶
func (e DirectoryGraph) InvertByExt() ExtToFileNode
inverts a DirectoryGraph creating a constant time lookup from map[FileExtension][]FileNode This includes the SysInfo last acquired from serialize() Acquires a lock on the result & e.DirectoryGraph while populating the index
func (DirectoryGraph) Open ¶ added in v0.0.12
func (e DirectoryGraph) Open() []*os.File
Returns an array of open files. If any errors are encountered while attempting to open a file in the graph they are silently ignored. The output may be empty.
func (DirectoryGraph) OpenAll ¶
func (e DirectoryGraph) OpenAll(exts ...FileExtension) []*os.File
type EncodingSet ¶
type EncodingSet [2]Transform
[0] encodes bytes & [1] decodes bytes, theorhetically atleast
type ExtToFileNode ¶
type ExtToFileNode map[FileExtension][]FileNode
func FindKeys ¶
func FindKeys(filepaths ...string) ExtToFileNode
returns any files using a common set of certificate file extensions from a ring of all children of filepaths should a given filepath have any. see DirectoryGraph for more details
func InitExtMap ¶
func InitExtMap(exts ...FileExtension) ExtToFileNode
func (ExtToFileNode) Exists ¶
func (e ExtToFileNode) Exists(ext FileExtension) bool
func (ExtToFileNode) Flatten ¶
func (e ExtToFileNode) Flatten() []FileNode
flattens the FileNodes (values) down to an array
func (ExtToFileNode) OpenAll ¶
func (e ExtToFileNode) OpenAll() []*os.File
type FileExtension ¶
type FileExtension string
const ( EXT_JSON FileExtension = ".json" EXT_CSV FileExtension = ".csv" EXT_TXT FileExtension = ".txt" EXT_MD FileExtension = ".md" EXT_MOV FileExtension = ".mov" EXT_WAV FileExtension = ".wav" EXT_GIF FileExtension = ".gif" EXT_PNG FileExtension = ".png" EXT_JPG FileExtension = ".jpg" EXT_JPEG FileExtension = ".jpeg" EXT_CRT FileExtension = ".crt" EXT_CERT FileExtension = ".cert" EXT_PEM FileExtension = ".pem" EXT_CSR FileExtension = ".csr" EXT_SH FileExtension = ".sh" EXT_GO FileExtension = ".go" EXT_JS FileExtension = ".js" EXT_PY FileExtension = ".py" EXT_C FileExtension = ".c" EXT_AGE FileExtension = ".age" EXT_NOEXT FileExtension = "" )
type FlagToEncodingSet ¶
type FlagToEncodingSet map[string]EncodingSet
maps flags to their possible encoding functions
func GenEncSet ¶
func GenEncSet() FlagToEncodingSet
Mapping of cli flags to encoding sets, including the default mapped to ""
func (FlagToEncodingSet) GetOrDefault ¶
func (set FlagToEncodingSet) GetOrDefault(flag string) (Transform, Transform)
Gets the encoding set or returns athe default select encoding
type LClient ¶
type LClient struct {
API, User string
PublicKey, ServerKey *age.X25519Recipient
// contains filtered or unexported fields
}
func NewClientFromPath ¶
func (*LClient) FmtRequest ¶
func (c *LClient) FmtRequest(endpoint ValidEndpoint, args ...string) *bytes.Buffer
func (*LClient) GetServerKey ¶
func (c *LClient) GetServerKey() (*age.X25519Recipient, error)
type Linker ¶
type Linker struct { S *http.Server RC *redis.Client SM map[string]func(rw http.ResponseWriter, r *http.Request) }
func NewLinker ¶
Creates a new linker pubDomain is the public-facing domain name used by the server. (e.g. foo.com) redisDomain is the domain name of the redis instance to connect to. if no port is specified on the end of either domain (e.g. foo.com:443) then a default port of 443 will be used for pubDomain and a default port of 31527 will be used for the redis instance.
type Set ¶
func (*Set) Ham ¶
Returns a new Set containing the hamming distance between s and set. s is not changed.
func (*Set) Permute ¶ added in v0.0.7
Returns two permutations of s and a pseudo random prime of equal bit-length to s.
func (*Set) Split ¶ added in v0.0.9
Creates and returns two deep copies of s and shifts each a single bit to the left or right, respectively. s is not changed.
type Universe ¶
type Universe struct {
// contains filtered or unexported fields
}
a ring of discrete Sets. https://en.wikipedia.org/wiki/Discrete
func DecodePEMFile ¶
Attempts to read/decode a file at path into a Universe. Returns an error if the file cannot be read or decoded.
func PointDistribution ¶
Distributes all probability onto U0 where U == U[0..2]^bit and returns U.
func UniformByExp ¶ added in v0.0.12
Evenly distributes U[0..S^N] over U and returns U.
func UniformByPow ¶ added in v0.0.12
Evenly distributes U[0^S..1^S..N] over U, return U.
func UniformDistribution ¶
Evenly distributes U[0..2]^N over U and returns U.
func UniformDistributionRp ¶
Evenly distributes U[Rp(Z)]^N over U and returns U.
func UniformFrom ¶
Returns a uniformly distributed Universe of ...bytes.
func UniformOfPrimes ¶ added in v0.0.13
Evenly distributes (probably) all primes between U[0..N] over U, return U. A Miller-Rabin test with S pseudorandomly chosen bases as well as a Baillie-PSW test is run on each number between U[0..N]. S = 1 is a solid default choice.
func UniformOver ¶
Returns a uniformly distributed Universe of ...sets.
func UniformRange ¶ added in v0.0.7
Uniformly distributes U[2^n..2^N] returns U.
func (*Universe) Intersection ¶
Sets u equal to u ⋂ U, return u.
func (*Universe) Join ¶
Sets u equal to the intersection of ...together. Unlike Intersection, Join will not filter unique values.
type ValidEndpoint ¶
type ValidEndpoint string
const ( GET_KEY ValidEndpoint = "get" SET_KEY ValidEndpoint = "set" HOME ValidEndpoint = "" )