tlsmdb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tlsmdb implements tlsutil.Archive using mongodb backend.

This package is a work in progress and makes no API stability promises.

Index

Constants

View Source
const (
	ConnectionColName  = "connections"
	CertificateColName = "certificates"
	RecordsColName     = "records"
)

Collection names.

View Source
const (
	DefaultDBName               = "luidsdb"
	DefaultConnsBulkSize        = 256
	DefaultRecordsBulkSize      = 1024
	DefaultSyncSeconds          = 5
	DefaultCacheCertsExpiration = 30 * time.Minute
	DefaultCacheCertsCleanUp    = 5 * time.Minute
)

Default values.

View Source
const ServiceClass = "tlsmdb"

ServiceClass registered.

Variables

This section is empty.

Functions

func Builder

func Builder() archive.BuildServiceFn

Builder returns a builder function.

Types

type Archiver

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

Archiver implements tls archive backend using a mongo database.

func New

func New(id string, session *mgo.Session, db string, opt ...Option) *Archiver

New creates a new storage.

func (*Archiver) Class

func (a *Archiver) Class() string

Class implements archive.Service interface.

func (*Archiver) ID

func (a *Archiver) ID() string

ID implements archive.Service interface.

func (*Archiver) Implements

func (a *Archiver) Implements() []archive.API

Implements implements archive.Service interface.

func (*Archiver) Ping

func (a *Archiver) Ping() error

Ping tests the connection with the storage.

func (*Archiver) SaveCertificate

func (a *Archiver) SaveCertificate(ctx context.Context, cert *tlsutil.CertificateData) (string, error)

SaveCertificate implements tlsutil.Archiver interface.

func (*Archiver) SaveConnection

func (a *Archiver) SaveConnection(ctx context.Context, cn *tlsutil.ConnectionData) (string, error)

SaveConnection implements tlsutil.Archiver interface.

func (*Archiver) Shutdown

func (a *Archiver) Shutdown()

Shutdown closes the conection.

func (*Archiver) Start

func (a *Archiver) Start() error

Start the archiver.

func (*Archiver) StoreRecord

func (a *Archiver) StoreRecord(r *tlsutil.RecordData) error

StoreRecord implements tlsutil.Archiver interface.

type Option

type Option func(*options)

Option encapsules options.

func CloseSession

func CloseSession(b bool) Option

CloseSession option allows close mongo session on shutdown.

func SetLogger

func SetLogger(l yalogi.Logger) Option

SetLogger option allows set a custom logger.

func SetPrefix

func SetPrefix(s string) Option

SetPrefix option allows set a prefix to collection.

Jump to

Keyboard shortcuts

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