Documentation ¶
Overview ¶
Copyright (C) 2021 light-river, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func Changes(stat1, stat2 fs.FileInfo) (Change, Change)
- func ChunkBytesVariablely(byteArr []byte, chunks int) [][]byte
- func ChunkedRandomPrime(bits, chunks int) [][]byte
- func Counter(arr []byte) (map[byte]int, map[int]byte, int)
- func CreateSelfSignedCertificates(proxy ReverseProxy)
- func DecodeBase64(arr []byte, c chan []byte)
- func DecodeHex(src []byte) chan []byte
- func EncodeBase64(arr []byte, c chan []byte)
- func EncodeHex(src []byte) chan []byte
- func EncodeRune(arr []byte, c chan []rune)
- func FixedXOR(src []byte, res chan []byte)
- func GenerateLogger(logFileName string) *log.Logger
- func MostFrequentIn(arr []byte) byte
- func NewNetworkGraph(args Edge) *ring.Ring
- func OpenTempFile() *os.File
- func PrettyPrint(v interface{}) string
- func PrintAll(r *ring.Ring)
- func RandomPrime(bits int) []byte
- func RootCTX() context.Context
- func StartServer(ctx context.Context, proxy *ReverseProxy)
- func Sum(nums ...byte) int
- func Tar(src string, writers ...io.Writer) error
- func Version() string
- func WithContext(parentContext context.Context) net.Dialer
- type Change
- type ContextHandler
- type DirectoryGraph
- type Edge
- type Environment
- type EphemeralId
- type EphemeralUser
- type FileNode
- type KeyPair
- type PrivateKey
- type ProxyManager
- type PublicKey
- type ReverseProxy
- type ReverseProxyConfig
- type RootContext
- type SessionPool
- type StartContext
- type SysInfo
- type Weights
Constants ¶
const ( DEFAULT_flip_TMP_ROOT string = ".data/tmp" DEFAULT_TEMP_EXECUTION_PARENT string = "run-*" DEFAULT_COMPRESSION_FORMAT string = "%v.zst" DEFAULT_METADATA_FORMAT string = "%v.meta" )
We create the following EnvFile for each execution
OS_TEMP/ 1. Operating system temporary directory
| - TEMP_PARENT/ 2. The parent sub-directory for all flip executions | - TEMP_PREFIX-$RANDOM/ 3. A per-execution sub-directory | $CONCURRENT_ORDERED_FILENAME.TEMP_EXTENSION/ 4. Chunks that are written with a reconstructable order despite concurrent creation
Variables ¶
This section is empty.
Functions ¶
func ChunkBytesVariablely ¶
func ChunkedRandomPrime ¶
func CreateSelfSignedCertificates ¶
func CreateSelfSignedCertificates(proxy ReverseProxy)
CreateSelfSignedCertificates
Creates a CA Cert & Key for a given ReverseProxy & writes to disk
func DecodeBase64 ¶
func EncodeBase64 ¶
func EncodeRune ¶
func FixedXOR ¶
FixedXOR
The resulting channel will get a hex encoded []byte created from the XOR of each byte i where src[i] XOR [i+len(src)/2] while any []byte can be the src the general use-case is to pre-encode src to hex
func GenerateLogger ¶
func MostFrequentIn ¶
func NewNetworkGraph ¶
Graph Builds a two-dimensional, rectangular graph, Wraps *ring.Ring
func OpenTempFile ¶
func PrettyPrint ¶
func PrettyPrint(v interface{}) string
func PrintAll ¶
PrintAll Prints all nodes in a subgraph Passing root will print the entire graph
Take note of `r.Do`, this basic example shows how to:
- cast to our type `Edge`
- Print, however, this can be any transformation `f(e)`
func RandomPrime ¶
func StartServer ¶
func StartServer(ctx context.Context, proxy *ReverseProxy)
Starts http server & defers closing of it as a default/backup
Types ¶
type ContextHandler ¶
type ContextHandler interface { Key() Value() }
type DirectoryGraph ¶
func NewDirectoryGraph ¶
func NewDirectoryGraph(root string) DirectoryGraph
* Initilization Functions for initilizing a new graph
func (DirectoryGraph) Size ¶
func (g DirectoryGraph) Size() int
type Edge ¶
type Edge struct {
Depth, Breadth int
}
Edge
Represents either the bounds of or a single point within a two-dimensional matrix/graph. You can create new, traverse & route requests to individual containers starting from any `Edge` Here is what `Graph(Edge{2, 4})` generates
*
┌────────┐ ┌─────────────┤e[-1,-1]├────────────────┐ │ └────────┘ │ │ │ ┌────┴───┐ ┌────▼───┐ │ e[0,0] │ │ e[1,0] │ ┌─────────┼────────┼──────────┐ ┌─────────┼────────┼──────────┐ │ │ │ │ │ │ │ │
┌────▼───┬┬────▼───┬┬───▼────┬┬────▼───||────▼───┬┬────▼───┬┬───▼────┬┬────▼───┐ │ e[0,1] ││ e[0,2] ││ e[0,3] ││ e[0,4] || e[1,1] ││ e[1,2] ││ e[1,3] ││ e[1,4] │ └────────┴┴────────┴┴────────┴┴────────||────────┴┴────────┴┴────────┴┴────────┘
type Environment ¶
type Environment struct { Files []string // contains filtered or unexported fields }
func NewEnvironment ¶
func NewEnvironment() Environment
func (Environment) AddFile ¶
func (e Environment) AddFile(filename string)
func (Environment) AddFiles ¶
func (e Environment) AddFiles(files ...string) Environment
func (Environment) Compress ¶
func (e Environment) Compress()
func (Environment) CompressedFiles ¶
func (e Environment) CompressedFiles() []fs.FileInfo
func (Environment) Decompress ¶
func (e Environment) Decompress()
func (Environment) DecompressedFiles ¶
func (e Environment) DecompressedFiles() []fs.FileInfo
type EphemeralId ¶
type EphemeralId int
type EphemeralUser ¶
type EphemeralUser struct { Id EphemeralId GId EphemeralId // contains filtered or unexported fields }
type KeyPair ¶
type KeyPair struct { Pb PublicKey Pk PrivateKey // contains filtered or unexported fields }
func GenerateKeyPair ¶
GenerateKeyPair Creates a random pb, pk that sit along the P224 ellipitic curve which implements P-224 (see FIPS 186-3, section D.2.2). Additonally, a fixed XOR cipher is generated from the public key
type PrivateKey ¶
type PrivateKey []byte
type ProxyManager ¶
type ProxyManager struct {
Proxys []*ReverseProxy
}
type ReverseProxy ¶
type ReverseProxy struct { Cfg ReverseProxyConfig // contains filtered or unexported fields }
func (*ReverseProxy) CreateMockListeningService ¶
func (r *ReverseProxy) CreateMockListeningService()
CreateMockListeningService is called if the Service specific in ReverseProxyConfig was unreachable. It spins up a http server on the Service you intended to proxy to
func (*ReverseProxy) ListenForClose ¶
func (r *ReverseProxy) ListenForClose()
Listens on a channel for a kill sig (any byte)
type ReverseProxyConfig ¶
type ReverseProxyConfig struct { Domain string `yaml:"domain"` Service string `yaml:"service"` CertPath string `yaml:"cert"` KeyPath string `yaml:"key"` LetsEncrypt bool `yaml:"letsencrypt"` Term chan byte Dialer net.Dialer }
func (ReverseProxyConfig) NewProxy ¶
func (cfg ReverseProxyConfig) NewProxy(parentCtx context.Context) (ReverseProxy, context.Context)
type RootContext ¶
type SessionPool ¶
type StartContext ¶
func (*StartContext) GetKey ¶
func (t *StartContext) GetKey() string
func (*StartContext) GetTime ¶
func (t *StartContext) GetTime() time.Time