Documentation ¶
Index ¶
- Constants
- type Backend
- func (b *Backend) Close() error
- func (e Backend) DeleteExpiredASHostKeys(ctx context.Context, cutoff time.Time) (int, error)
- func (e Backend) DeleteExpiredHostASKeys(ctx context.Context, cutoff time.Time) (int, error)
- func (e Backend) DeleteExpiredHostHostKeys(ctx context.Context, cutoff time.Time) (int, error)
- func (e Backend) GetASHostKey(ctx context.Context, meta drkey.ASHostMeta) (drkey.ASHostKey, error)
- func (e Backend) GetHostASKey(ctx context.Context, meta drkey.HostASMeta) (drkey.HostASKey, error)
- func (e Backend) GetHostHostKey(ctx context.Context, meta drkey.HostHostMeta) (drkey.HostHostKey, error)
- func (e Backend) InsertASHostKey(ctx context.Context, key drkey.ASHostKey) error
- func (e Backend) InsertHostASKey(ctx context.Context, key drkey.HostASKey) error
- func (e Backend) InsertHostHostKey(ctx context.Context, key drkey.HostHostKey) error
- func (b *Backend) SetMaxIdleConns(maxIdleConns int)
- func (b *Backend) SetMaxOpenConns(maxOpenConns int)
Constants ¶
const ( // Level2SchemaVersion is the version of the SQLite schema understood by this backend. // Whenever changes to the schema are made, this version number should be increased // to prevent data corruption between incompatible database schemas. Level2SchemaVersion = 1 // Level2Schema is the SQLite database layout. Level2Schema = ` CREATE TABLE ASHost ( Protocol INTEGER NOT NULL, SrcIsdID INTEGER NOT NULL, SrcAsID INTEGER NOT NULL, DstIsdID INTEGER NOT NULL, DstAsID INTEGER NOT NULL, DstHostIP TEXT, EpochBegin INTEGER NOT NULL, EpochEnd INTEGER NOT NULL, Key BLOB NOT NULL, PRIMARY KEY (Protocol, SrcIsdID, SrcAsID,` + ` DstIsdID, DstAsID, DstHostIP, EpochBegin) ); CREATE TABLE HostAS ( Protocol INTEGER NOT NULL, SrcIsdID INTEGER NOT NULL, SrcAsID INTEGER NOT NULL, DstIsdID INTEGER NOT NULL, DstAsID INTEGER NOT NULL, SrcHostIP TEXT, EpochBegin INTEGER NOT NULL, EpochEnd INTEGER NOT NULL, Key BLOB NOT NULL, PRIMARY KEY (Protocol, SrcIsdID, SrcAsID,` + ` DstIsdID, DstAsID, SrcHostIP, EpochBegin) ); CREATE TABLE HostHost ( Protocol INTEGER NOT NULL, SrcIsdID INTEGER NOT NULL, SrcAsID INTEGER NOT NULL, DstIsdID INTEGER NOT NULL, DstAsID INTEGER NOT NULL, SrcHostIP TEXT, DstHostIP TEXT, EpochBegin INTEGER NOT NULL, EpochEnd INTEGER NOT NULL, Key BLOB NOT NULL, PRIMARY KEY (Protocol, SrcIsdID, SrcAsID,` + ` DstIsdID, DstAsID, SrcHostIP, DstHostIP, EpochBegin) ); ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements a level 2 drkey DB with sqlite.
func NewBackend ¶
NewBackend creates a database and prepares all statements.
func (Backend) DeleteExpiredASHostKeys ¶
DeleteExpiredASHostKeys removes all expired AS-Host keys, i.e. those keys which expiration time is strictly less than the cutoff
func (Backend) DeleteExpiredHostASKeys ¶
DeleteExpiredHostASKeys removes all expired Host-AS keys, i.e. those keys which expiration time is strictly less than the cutoff
func (Backend) DeleteExpiredHostHostKeys ¶
DeleteExpiredHostHostKeys removes all expired Host-Host keys, i.e. those keys which expiration time is strictly less than the cutoff
func (Backend) GetASHostKey ¶
GetASHostKey takes metadata information for the ASHost key and a timestamp at which it should be valid and returns the corresponding key.
func (Backend) GetHostASKey ¶
GetHostASKey takes metadata information for the HostAS key and a timestamp at which it should be valid and returns the corresponding key.
func (Backend) GetHostHostKey ¶
func (e Backend) GetHostHostKey( ctx context.Context, meta drkey.HostHostMeta) (drkey.HostHostKey, error)
GetHostHostKey takes metadata information for the HostHost key and a timestamp at which it should be valid and returns the corresponding key.
func (Backend) InsertASHostKey ¶
InsertASHostKey inserts a ASHost key.
func (Backend) InsertHostASKey ¶
InsertHostASKey inserts a HostAS key.
func (Backend) InsertHostHostKey ¶
func (e Backend) InsertHostHostKey(ctx context.Context, key drkey.HostHostKey) error
InsertHostHostKey inserts a HostHost key.
func (*Backend) SetMaxIdleConns ¶
SetMaxIdleConns sets the maximum number of idle connections.
func (*Backend) SetMaxOpenConns ¶
SetMaxOpenConns sets the maximum number of open connections.