ctlsock

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ctlsock is a Go library that can be used to query the gocryptfs control socket interface. This interface can be activated by passing `-ctlsock /tmp/my.sock` to gocryptfs on the command line. See gocryptfs-xray for a usage example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CtlSock

type CtlSock struct {
	Conn net.Conn
}

CtlSock encapsulates a control socket

func New

func New(socketPath string) (*CtlSock, error)

New opens the socket at `socketPath` and stores it in a `CtlSock` object.

func (*CtlSock) Close

func (c *CtlSock) Close()

Close closes the socket

func (*CtlSock) Query

func (c *CtlSock) Query(req *RequestStruct) (*ResponseStruct, error)

Query sends a request to the control socket returns the response.

type RequestStruct

type RequestStruct struct {
	// EncryptPath is the path that should be encrypted.
	EncryptPath string
	// DecryptPath is the path that should be decrypted.
	DecryptPath string
}

RequestStruct is sent by a client (encoded as JSON). You cannot perform both encryption and decryption in the same request.

type ResponseStruct

type ResponseStruct struct {
	// Result is the resulting decrypted or encrypted path. Empty on error.
	Result string
	// ErrNo is the error number as defined in errno.h.
	// 0 means success and -1 means that the error number is not known
	// (look at ErrText in this case).
	ErrNo int32
	// ErrText is a detailed error message.
	ErrText string
	// WarnText contains warnings that may have been encountered while
	// processing the message.
	WarnText string
}

ResponseStruct is sent by the server in response to a request (encoded as JSON).

func (*ResponseStruct) Error

func (r *ResponseStruct) Error() string

Jump to

Keyboard shortcuts

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