utils

package module
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 13 Imported by: 0

README

uds

Unix Domain Socket utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectSocket added in v0.1.1

func ConnectSocket(address string, interval, deadline time.Duration) (*net.UnixConn, error)

sock, err := uds.ConnectSocket("/env/example.sock", time.Second*1, time.Second*5)

sock.Write(msg)

func Decrypt added in v0.1.3

func Decrypt(ciphertext []byte, key []byte) ([]byte, error)

func Encrypt added in v0.1.3

func Encrypt(plaintext []byte, key []byte) ([]byte, error)

func OpenSocket

func OpenSocket(a string) (*net.UnixListener, error)

listener, err := uds.OpenSocket("/env/example.sock")

Types

type Config added in v0.1.1

type Config struct {
	Instances map[string]Instance
	Producers map[string]Producer
	Consumers map[string]Consumer
	Params    map[string]interface{}
}

func (*Config) Parse added in v0.1.14

func (c *Config) Parse(path ...string) error

Parse flow.toml config

use CONFIG_PATH env var if no parameters given

type Consumer added in v0.1.4

type Consumer struct {
	ID      string
	Produce string
	Topic   string
	Address string
	Params  map[string]interface{}
}
type Header struct {
	ConsumerID [16]byte
	ProducerID [16]byte
	DataLength uint32
}

type Instance added in v0.1.4

type Instance struct {
	ID      string
	Listen  string
	Produce string
	Params  map[string]interface{}
}

type Message added in v0.1.1

type Message struct {
	Header Header
	Data   []byte
}

func (*Message) Decode added in v0.1.1

func (m *Message) Decode(c net.Conn) error

func (*Message) Encode added in v0.1.1

func (m *Message) Encode() ([]byte, error)

func (*Message) ForwardMessage added in v0.1.2

func (m *Message) ForwardMessage(c *net.UnixConn) error

type Producer added in v0.1.4

type Producer struct {
	ID      string
	Listen  string
	Produce string
	Topic   string
	Address string
	Params  map[string]interface{}
}

Jump to

Keyboard shortcuts

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