This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
glue.go
106 lines (94 loc) · 2.86 KB
/
glue.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// glue.go - Katzenpost server internal glue.
// Copyright (C) 2017 Yawning Angel.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Package glue implements the glue structure that ties all the internal
// subpackages together.
package glue
import (
"github.com/katzenpost/core/crypto/ecdh"
"github.com/katzenpost/core/crypto/eddsa"
"github.com/katzenpost/core/log"
"github.com/katzenpost/core/pki"
"github.com/katzenpost/core/sphinx/constants"
"github.com/katzenpost/core/thwack"
"github.com/katzenpost/core/wire"
"github.com/katzenpost/server/config"
"github.com/katzenpost/server/internal/mixkey"
"github.com/katzenpost/server/internal/packet"
"github.com/katzenpost/server/internal/pkicache"
"github.com/katzenpost/server/spool"
"github.com/katzenpost/server/userdb"
)
// Glue is the structure that binds the internal components together.
type Glue interface {
Config() *config.Config
LogBackend() *log.Backend
IdentityKey() *eddsa.PrivateKey
LinkKey() *ecdh.PrivateKey
Management() *thwack.Server
MixKeys() MixKeys
PKI() PKI
Provider() Provider
Scheduler() Scheduler
Connector() Connector
Listeners() []Listener
Decoy() Decoy
ReshadowCryptoWorkers()
}
type MixKeys interface {
Halt()
Generate(uint64) (bool, error)
Prune() bool
Get(uint64) (*ecdh.PublicKey, bool)
Shadow(map[uint64]*mixkey.MixKey)
}
type PKI interface {
Halt()
StartWorker()
OutgoingDestinations() map[[constants.NodeIDLength]byte]*pki.MixDescriptor
AuthenticateConnection(*wire.PeerCredentials, bool) (*pki.MixDescriptor, bool, bool)
GetRawConsensus(uint64) ([]byte, error)
}
type Provider interface {
Halt()
UserDB() userdb.UserDB
Spool() spool.Spool
AuthenticateClient(*wire.PeerCredentials) bool
OnPacket(*packet.Packet)
KaetzchenForPKI() (map[string]map[string]interface{}, error)
AdvertiseRegistrationHTTPAddresses() []string
}
type Scheduler interface {
Halt()
OnNewMixMaxDelay(uint64)
OnPacket(*packet.Packet)
}
type Connector interface {
Halt()
DispatchPacket(*packet.Packet)
IsValidForwardDest(*[constants.NodeIDLength]byte) bool
ForceUpdate()
}
type Listener interface {
Halt()
IsConnUnique(interface{}) bool
OnNewSendRatePerMinute(uint64)
OnNewSendBurst(uint64)
}
type Decoy interface {
Halt()
OnNewDocument(*pkicache.Entry)
OnPacket(*packet.Packet)
}