ipc

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

Go support for psk-local-ipc

This project hosts the Go implementation for psk-local-ipc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client - holds the details of the client Connection and config.

func StartClient

func StartClient(ipcName string, config *ClientConfig) (*Client, error)

StartClient - start the ipc client.

ipcName = is the name of the unix socket or named pipe that the client will try and connect to. timeout = number of seconds before the socket/pipe times out trying to connect/re-cconnect - if -1 or 0 it never times out. retryTimer = number of seconds before the client tries to connect again.

func (*Client) Close

func (cc *Client) Close()

Close - closes the Connection

func (*Client) Read

func (cc *Client) Read() (*Message, error)

Read - blocking function that waits until an non multipart message is recieved returns the message type, data and any error.

func (*Client) Status

func (cc *Client) Status() Status

Status - returns the current Connection status as a string

func (*Client) Write

func (cc *Client) Write(msgType int, message []byte) error

Write - writes a non multipart message to the ipc Connection. msgType - denotes the type of data being sent. 0 is a reserved type for internal messages and errors.

type ClientConfig

type ClientConfig struct {
	SocketDirectory string
	Timeout         float64
	RetryTimer      time.Duration
	PskConfig       tls.PSKConfig
}

ClientConfig - used to pass configuation overrides to ClientStart()

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection

func (*Connection) Close

func (connection *Connection) Close()

func (*Connection) Write

func (connection *Connection) Write(msgType int, message []byte) error

Write - writes a non multipart message to the ipc Connection. msgType - denotes the type of data being sent. 0 is a reserved type for internal messages and errors.

type ListenConfig

type ListenConfig struct {
	// contains filtered or unexported fields
}

type Message

type Message struct {
	MsgType    int // type of message sent - 0 is reserved
	Connection *Connection

	Data   []byte // message data recieved
	Status Status
	// contains filtered or unexported fields
}

Message - contains the recieved message

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server - holds the details of the server Connection & config.

func StartServer

func StartServer(ipcName string, config *ServerConfig) (*Server, error)

StartServer - starts the ipc server.

ipcName = is the name of the unix socket or named pipe that will be created. timeout = number of seconds before the socket/pipe times out waiting for a Connection/re-cconnection - if -1 or 0 it never times out.

func (*Server) Close

func (sc *Server) Close()

Close - closes the Connection

func (*Server) Read

func (sc *Server) Read() (*Message, error)

func (*Server) Status

func (sc *Server) Status() Status

Status - returns the current Connection status as a string

type ServerChannel

type ServerChannel struct {
	// contains filtered or unexported fields
}

func (*ServerChannel) Addr

func (sc *ServerChannel) Addr() net.Addr

type ServerConfig

type ServerConfig struct {
	SocketDirectory    string
	Timeout            time.Duration
	MaxMsgSize         int
	UseUnmask          bool
	Unmask             int
	SecurityDescriptor string
	PskConfig          tls.PSKConfig
}

ServerConfig - used to pass configuation overrides to ServerStart()

type Status

type Status int

Status - Status of the Connection

const (

	// NotConnected - 0
	NotConnected Status = iota
	// Listening - 1
	Listening Status = iota
	// Connecting - 2
	Connecting Status = iota
	// Connected - 3
	Connected Status = iota
	// ReConnecting - 4
	ReConnecting Status = iota
	// Closed - 5
	Closed Status = iota
	// Closing - 6
	Closing Status = iota
	// Error - 7
	Error Status = iota
	// Timeout - 8
	Timeout Status = iota
)

func (*Status) String

func (status *Status) String() string

returns the status of the Connection as a string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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