rpcsrv

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package rpcsrv implements a RPC server for ddc library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClamAVConfigure added in v0.2.0

func ClamAVConfigure(network, address string)

ClamAVConfigure enables ClamAV integration via clamd socket. Should be called only before Start.

func Start

func Start(network, address string, errChan chan error) error

Start JSON-RPC server on the specified network and address (see net.Listen(network, address)). Function returns error in case if net.Listen(network, address) failed, errChan is used to send errors that occur later.

func Stop

func Stop() error

Stop server

Types

type Builder

type Builder int

Builder can be exported via net/rpc and used to build DDC

func (*Builder) AppendDocumentPart

func (t *Builder) AppendDocumentPart(args *BuilderAppendDocumentPartArgs, resp *BuilderAppendDocumentPartResp) error

AppendDocumentPart to the specified builder slot

func (*Builder) AppendSignature

func (t *Builder) AppendSignature(args *BuilderAppendSignatureArgs, resp *BuilderAppendSignatureResp) error

AppendSignature to the specified builder slot

func (*Builder) Build

func (t *Builder) Build(args *BuilderBuildArgs, resp *BuilderBuildResp) error

Build DDC in the specified slot, should be called once after all data've been passed to the slot via calls to AppendDocumentPart and AppendSignature

func (*Builder) Drop

func (t *Builder) Drop(args *BuilderDropArgs, _ *BuilderDropResp) error

Drop DDC in the specified slot

func (*Builder) GetDDCPart

func (t *Builder) GetDDCPart(args *BuilderGetDDCPartArgs, resp *BuilderGetDDCPartResp) error

GetDDCPart retrieves parts of the DDC in the specified slot successively, should be called after Build

func (*Builder) Register

func (t *Builder) Register(args *BuilderRegisterArgs, resp *BuilderRegisterResp) error

Register new builder slot and retrieve it's id

type BuilderAppendDocumentPartArgs

type BuilderAppendDocumentPartArgs struct {
	// ID of the builder slot to use
	ID string

	// Part of the original document
	Bytes []byte
}

BuilderAppendDocumentPartArgs used to pass data to Builder.AppendDocumentPart

type BuilderAppendDocumentPartResp added in v0.3.0

type BuilderAppendDocumentPartResp struct {
	// Error is not "" if any error occurred during the operation
	Error string
}

BuilderAppendDocumentPartResp used to retrieve data from Builder.AppendDocumentPart

type BuilderAppendSignatureArgs

type BuilderAppendSignatureArgs struct {
	// ID of the builder slot to use
	ID string

	// SignatureInfo describes the signature
	SignatureInfo ddc.SignatureInfo
}

BuilderAppendSignatureArgs used to pass data to Builder.AppendSignature

type BuilderAppendSignatureResp added in v0.3.0

type BuilderAppendSignatureResp struct {
	// Error is not "" if any error occurred during the operation
	Error string
}

BuilderAppendSignatureResp used to retrieve data from Builder.AppendSignature

type BuilderBuildArgs

type BuilderBuildArgs struct {
	// ID of the builder slot to use
	ID string

	// CreationDate should be current date and time in format "2021.01.31 13:45:00 UTC+6"
	// converted to time zone of Nur-Sultan.
	CreationDate string

	// BuilderName would be embedded into DDC visualization
	BuilderName string

	// HowToVerify should provide instructions to verify DDC
	HowToVerify string

	// WithoutDocumentVisualization builds a DDC without document visualization, should be set to `true` for non-PDF documents
	WithoutDocumentVisualization bool

	// WithoutSignaturesVisualization builds a DDC without signatures visualization
	WithoutSignaturesVisualization bool
}

BuilderBuildArgs used to pass data to Builder.Build

type BuilderBuildResp added in v0.3.0

type BuilderBuildResp struct {
	// Error is not "" if any error occurred during the operation
	Error string
}

BuilderBuildResp used to retrieve data from Builder.Build

type BuilderDropArgs

type BuilderDropArgs struct {
	// ID of the builder slot to use
	ID string
}

BuilderDropArgs used to pass data to Builder.Drop

type BuilderDropResp added in v0.3.0

type BuilderDropResp struct {
	// Error is not "" if any error occurred during the operation
	Error string
}

BuilderDropResp used to retrieve data from Builder.Drop

type BuilderGetDDCPartArgs

type BuilderGetDDCPartArgs struct {
	// ID of the builder slot to use
	ID string

	// MaxPartSize should be used to limit the size of the part
	MaxPartSize int
}

BuilderGetDDCPartArgs used to pass data to Builder.GetDDCPart

type BuilderGetDDCPartResp

type BuilderGetDDCPartResp struct {
	// Error is not "" if any error occurred during the operation
	Error string

	// Part of DDC not larger than MaxPartSize
	Part []byte

	// IsFinal signals that there are no more parts to return
	IsFinal bool
}

BuilderGetDDCPartResp used to retrieve data from Builder.GetDDCPart

type BuilderRegisterArgs

type BuilderRegisterArgs struct {
	// Title of the document
	Title string

	// Description of the document
	Description string

	// Optional id of the document
	ID string

	// Optional qr code with the id of the document, should be set if id is set
	IDQRCode []byte

	// Optional qr code with the link to the document accessible from internet
	LinkQRCode []byte

	BuilderLogo []byte

	// Optional string printed under the builder logo
	SubBuilderLogoString string

	// FileName of the original document
	FileName string

	// Set language ["ru", "kk", "kk/ru"]
	Language string
}

BuilderRegisterArgs used to pass data to Builder.Register

type BuilderRegisterResp added in v0.3.0

type BuilderRegisterResp struct {
	// Error is not "" if any error occurred during the operation
	Error string

	// ID of the new builder slot
	ID string
}

BuilderRegisterResp used to retrieve data from Builder.Register

type Extractor

type Extractor int

Extractor can be exported via net/rpc and used to extract embedded files from DDC

func (*Extractor) AppendDDCPart

AppendDDCPart to the specified extractor slot

func (*Extractor) Drop

Drop DDC in the specified slot

func (*Extractor) GetDocumentPart

GetDocumentPart retrieves parts of the original document in the specified slot successively, should be called after Parse

func (*Extractor) GetSignature

GetSignature retrieves signatures that've benn embedded into DDC successively, should be called after Parse

func (*Extractor) Parse

func (t *Extractor) Parse(args *ExtractorParseArgs, resp *ExtractorParseResp) error

Parse DDC in the specified slot, should be called after all parts of DDC've been transmitted via AppendDDCPart

func (*Extractor) Register

Register new extractor slot and retrieve it's id

type ExtractorAppendDDCPartArgs

type ExtractorAppendDDCPartArgs struct {
	// ID of the extractor slot to use
	ID string

	// Part of the DDC
	Part []byte
}

ExtractorAppendDDCPartArgs used to pass data to Extractor.AppendDDCPart

type ExtractorAppendDDCPartResp added in v0.3.0

type ExtractorAppendDDCPartResp struct {
	// Error is not "" if any error occurred during the operation
	Error string
}

ExtractorAppendDDCPartResp used to retrieve data from Extractor.AppendDDCPart

type ExtractorDropArgs

type ExtractorDropArgs struct {
	// ID of the extractor slot to use
	ID string
}

ExtractorDropArgs used to pass data to Extractor.Drop

type ExtractorDropResp added in v0.3.0

type ExtractorDropResp struct {
	// Error is not "" if any error occurred during the operation
	Error string
}

ExtractorDropResp used to retrieve data from Extractor.Drop

type ExtractorGetDocumentPartArgs

type ExtractorGetDocumentPartArgs struct {
	// ID of the extractor slot to use
	ID string

	// MaxPartSize should be used to limit the size of the part
	MaxPartSize int

	// Rewind to the beginning of the document
	Rewind bool
}

ExtractorGetDocumentPartArgs used to pass data to Extractor.GetDocumentPart

type ExtractorGetDocumentPartResp

type ExtractorGetDocumentPartResp struct {
	// Error is not "" if any error occurred during the operation
	Error string

	// Part of the original document not larger than MaxPartSize
	Part []byte

	// IsFinal signals that there are no more parts to return
	IsFinal bool
}

ExtractorGetDocumentPartResp used to retrieve data from Extractor.GetDocumentPart

type ExtractorGetSignatureArgs

type ExtractorGetSignatureArgs struct {
	// ID of the extractor slot to use
	ID string
}

ExtractorGetSignatureArgs used to pass data to Extractor.GetSignature

type ExtractorGetSignatureResp

type ExtractorGetSignatureResp struct {
	// Error is not "" if any error occurred during the operation
	Error string

	// Signature bytes and file name
	Signature ddc.AttachedFile

	// IsFinal signals that there are no more signatures to return
	IsFinal bool
}

ExtractorGetSignatureResp used to retrieve data from Extractor.GetSignature

type ExtractorParseArgs

type ExtractorParseArgs struct {
	// ID of the extractor slot to use
	ID string
}

ExtractorParseArgs used to pass data to Extractor.Parse

type ExtractorParseResp added in v0.3.0

type ExtractorParseResp struct {
	// Error is not "" if any error occurred during the operation
	Error string

	// DocumentFileName extracted from DDC
	DocumentFileName string
}

ExtractorParseResp used to retrieve data from Extractor.Parse

type ExtractorRegisterArgs

type ExtractorRegisterArgs struct {
}

ExtractorRegisterArgs used to pass data to Extractor.Register

type ExtractorRegisterResp added in v0.3.0

type ExtractorRegisterResp struct {
	// Error is not "" if any error occurred during the operation
	Error string

	// ID of the new extractor slot
	ID string
}

ExtractorRegisterResp used to retrieve data from Extractor.Register

Directories

Path Synopsis
Runs ddc RPC server
Runs ddc RPC server

Jump to

Keyboard shortcuts

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