Documentation ¶
Index ¶
- func NewDb() *db
- func NewService(db IDb) *service
- type CocoHostSanitizer
- type CoconodeSanitizer
- type Config
- type Controller
- type GatewayHostSanitizer
- type GatewaySanitizer
- type IDb
- type IMixNodeIDSanitizer
- type IPAssigner
- type IService
- type MixHostSanitizer
- type MixNodeIDSanitizer
- type MixProviderHostSanitizer
- type MixnodeSanitizer
- type MixproviderSanitizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CocoHostSanitizer ¶ added in v0.0.4
type CocoHostSanitizer interface {
Sanitize(models.CocoHostInfo) models.CocoHostInfo
}
CocoHostSanitizer cleans untrusted input fields
type CoconodeSanitizer ¶ added in v0.0.4
type CoconodeSanitizer struct {
// contains filtered or unexported fields
}
CoconodeSanitizer kills untrusted input in CocoHostInfo structs
func NewCoconodeSanitizer ¶ added in v0.0.4
func NewCoconodeSanitizer(p *bluemonday.Policy) CoconodeSanitizer
NewCoconodeSanitizer constructor...
func (*CoconodeSanitizer) Sanitize ¶ added in v0.0.4
func (s *CoconodeSanitizer) Sanitize(input models.CocoHostInfo) models.CocoHostInfo
Sanitize CocoHostInfo input
type Config ¶ added in v0.0.4
type Config struct { CocoHostSanitizer CocoHostSanitizer MixHostSanitizer MixHostSanitizer MixNodeIDSanitizer IMixNodeIDSanitizer MixProviderHostSanitizer MixProviderHostSanitizer GatewayHostSanitizer GatewayHostSanitizer Service IService }
Config for this controller
type Controller ¶
type Controller interface { AddCocoNodePresence(c *gin.Context) AddMixNodePresence(c *gin.Context) Topology(c *gin.Context) RegisterRoutes(router *gin.Engine) }
Controller is the presence controller interface
type GatewayHostSanitizer ¶ added in v0.7.0
type GatewayHostSanitizer interface {
Sanitize(models.GatewayHostInfo) models.GatewayHostInfo
}
GatewayHostSanitizer cleans untrusted input fields
type GatewaySanitizer ¶ added in v0.7.0
type GatewaySanitizer struct {
// contains filtered or unexported fields
}
GatewaySanitizer kills untrusted input in GatewayHostInfo structs
func NewGatewaySanitizer ¶ added in v0.7.0
func NewGatewaySanitizer(p *bluemonday.Policy) GatewaySanitizer
NewGatewaySanitizer constructor...
func (*GatewaySanitizer) Sanitize ¶ added in v0.7.0
func (s *GatewaySanitizer) Sanitize(input models.GatewayHostInfo) models.GatewayHostInfo
Sanitize GatewayHostInfo input
type IDb ¶ added in v0.0.4
type IDb interface { AddCoco(models.CocoPresence) AddMix(models.MixNodePresence) AddMixProvider(models.MixProviderPresence) AddGateway(models.GatewayPresence) Allow(string) Disallow(string) ListDisallowed() []string Topology() models.Topology }
IDb holds presence information
type IMixNodeIDSanitizer ¶ added in v0.7.0
IMixNodeIDSanitizer cleans untrusted input fields
type IPAssigner ¶ added in v0.0.4
type IPAssigner interface {
AssignIP(serverReportedIP string, selfReportedHost string) (string, error)
}
IPAssigner compares the realIP (taken from the incoming request to the controller) and the self-reported presence IP (taken from the presence report data), and tries to report a reasonable IP. Much like the trouble with SUVs detailed by Paul Graham (http://www.paulgraham.com/hundred.html), this is a gross solution to a gross problem.
In our case, the cause of hassle is that AWS servers: (a) don't allow applications hosted on them to determine what address they're binding to easily, because there are no "real" public IPs assigned, and (b) cause the application to explode if you attempt to bind to the public IP at all (private IPs do exist and can be bound to).
If we could, we'd always read from the incoming request - but this has another problem: incoming requests don't tell us which port the remote node is listening on. So we need to combine self-reported and real IP.
type IService ¶ added in v0.0.4
type IService interface { AddCocoNodePresence(info models.CocoHostInfo, ip string) AddMixNodePresence(info models.MixHostInfo) AddMixProviderPresence(info models.MixProviderHostInfo) AddGatewayPresence(info models.GatewayHostInfo) Allow(hostKey models.MixNodeID) Disallow(hostKey models.MixNodeID) ListDisallowed() []models.MixNodePresence Topology() models.Topology }
IService defines the REST service interface for presence.
type MixHostSanitizer ¶ added in v0.0.4
type MixHostSanitizer interface {
Sanitize(models.MixHostInfo) models.MixHostInfo
}
MixHostSanitizer cleans untrusted input fields
type MixNodeIDSanitizer ¶ added in v0.7.0
type MixNodeIDSanitizer struct {
// contains filtered or unexported fields
}
MixNodeIDSanitizer kills untrusted input in CocoHostInfo structs
func NewMixnodeIDSanitizer ¶ added in v0.7.0
func NewMixnodeIDSanitizer(p *bluemonday.Policy) MixNodeIDSanitizer
NewMixnodeIDSanitizer ...
type MixProviderHostSanitizer ¶ added in v0.0.4
type MixProviderHostSanitizer interface {
Sanitize(models.MixProviderHostInfo) models.MixProviderHostInfo
}
MixProviderHostSanitizer cleans untrusted input fields
type MixnodeSanitizer ¶ added in v0.0.4
type MixnodeSanitizer struct {
// contains filtered or unexported fields
}
MixnodeSanitizer kills untrusted input in MixHostInfo structs
func NewMixnodeSanitizer ¶ added in v0.0.4
func NewMixnodeSanitizer(p *bluemonday.Policy) MixnodeSanitizer
NewMixnodeSanitizer constructor...
func (*MixnodeSanitizer) Sanitize ¶ added in v0.0.4
func (s *MixnodeSanitizer) Sanitize(input models.MixHostInfo) models.MixHostInfo
Sanitize MixHostInfo input
type MixproviderSanitizer ¶ added in v0.0.4
type MixproviderSanitizer struct {
// contains filtered or unexported fields
}
MixproviderSanitizer kills untrusted input in MixProviderHostInfo structs
func NewMixproviderSanitizer ¶ added in v0.0.4
func NewMixproviderSanitizer(p *bluemonday.Policy) MixproviderSanitizer
NewMixproviderSanitizer constructor...
func (*MixproviderSanitizer) Sanitize ¶ added in v0.0.4
func (s *MixproviderSanitizer) Sanitize(input models.MixProviderHostInfo) models.MixProviderHostInfo
Sanitize MixProviderHostInfo input