Documentation ¶
Index ¶
- Constants
- Variables
- func CallRpcEndpoint(e string, p interface{}) (interface{}, error)
- func ConfigureTlsServer(cfg *tls.Config)
- func DbGet(key string) (string, error)
- func DbSet(key string, value []byte) error
- func DbWatch(key string, cb func(string, []byte))
- func EnsureDir(c string) error
- func GenInternalCert() (tls.Certificate, error)
- func GetCA() (*x509.CertPool, error)
- func GetClientTlsConfig() (*tls.Config, error)
- func GetDefaultPublicCert() (tls.Certificate, error)
- func GetInternalCert() (tls.Certificate, error)
- func GetTlsConfig() (*tls.Config, error)
- func Init()
- func LogDmesg(w io.Writer) (int64, error)
- func LogTarget() io.Writer
- func SeedCrypt(in []byte) ([]byte, error)
- func SeedDecrypt(in []byte) ([]byte, error)
- func SeedId() uuid.UUID
- func SeedSign(in []byte) []byte
- func SeedTlsConfig(c *tls.Config)
- func SetIssuer(url string)
- func SetRpcEndpoint(e string, f RpcEndpoint)
- func Shutdown()
- type AgentObj
- func (a *AgentObj) AddService(service string) chan net.Conn
- func (a *AgentObj) AnyRpc(division string, endpoint string, data interface{}) error
- func (a *AgentObj) BroadcastRpc(endpoint string, data interface{}) error
- func (a *AgentObj) Connect(id string, service string) (net.Conn, error)
- func (a *AgentObj) Dial(network, addr string) (net.Conn, error)
- func (a *AgentObj) DialContext(c context.Context, network, addr string) (net.Conn, error)
- func (a *AgentObj) DivisionPrefixRpc(divMatch string, endpoint string, data interface{}) error
- func (a *AgentObj) DivisionRpc(division int, endpoint string, data interface{}) error
- func (a *AgentObj) DumpInfo(w io.Writer)
- func (a *AgentObj) GetPeer(id string) *Peer
- func (a *AgentObj) GetPeerByName(name string) *Peer
- func (a *AgentObj) Id() string
- func (a *AgentObj) IsConnected(id string) bool
- func (a *AgentObj) Name() (string, string)
- func (a *AgentObj) RPC(id string, endpoint string, data interface{}) (interface{}, error)
- func (a *AgentObj) RoundTripper() http.RoundTripper
- func (a *AgentObj) SendTo(target string, pkt interface{}) error
- type DbCursor
- type DbStamp
- func (t DbStamp) After(t2 DbStamp) bool
- func (t *DbStamp) GobDecode(data []byte) error
- func (t DbStamp) GobEncode() ([]byte, error)
- func (t DbStamp) MarshalBinary() ([]byte, error)
- func (t DbStamp) String() string
- func (t DbStamp) Unix() int64
- func (t DbStamp) UnixNano() int64
- func (t *DbStamp) UnmarshalBinary(data []byte) error
- type DbWatchCallback
- type Packet
- type PacketAnnounce
- type PacketClose
- type PacketDbRecord
- type PacketDbRequest
- type PacketDbVersions
- type PacketDbVersionsEntry
- type PacketHandshake
- type PacketPong
- type PacketRpc
- type PacketRpcResponse
- type PacketSeed
- type Peer
- type RpcEndpoint
- type ServiceConn
- type SortablePeers
Constants ¶
View Source
const UUID_SEEDID_SPACE = "da736663-83ec-46ef-9c29-3f9102c5c519"
Variables ¶
View Source
var ( Agent = &AgentObj{ id: "local", name: "local", peers: make(map[string]*Peer), services: make(map[string]chan net.Conn), rpc: make(map[uintptr]chan *PacketRpcResponse), } )
View Source
var (
GetFile func(string) ([]byte, error)
)
Functions ¶
func CallRpcEndpoint ¶ added in v0.3.23
CallRpcEndpoint will call the named RPC endpoint on the local machine
func ConfigureTlsServer ¶
func DbWatch ¶ added in v0.3.16
DbWatch will trigger the cb function upon updates of the given key Special key "*" covers all keys (can only be one callback for a key)
func GenInternalCert ¶
func GenInternalCert() (tls.Certificate, error)
func GetClientTlsConfig ¶
func GetDefaultPublicCert ¶
func GetDefaultPublicCert() (tls.Certificate, error)
func GetInternalCert ¶
func GetInternalCert() (tls.Certificate, error)
func GetTlsConfig ¶
GetTlsConfig returns TLS config suitable for making public facing ssl servers.
func SeedDecrypt ¶
func SeedTlsConfig ¶
func SetRpcEndpoint ¶
func SetRpcEndpoint(e string, f RpcEndpoint)
Types ¶
type AgentObj ¶
type AgentObj struct {
// contains filtered or unexported fields
}
func (*AgentObj) BroadcastRpc ¶
func (*AgentObj) DialContext ¶
func (*AgentObj) DivisionPrefixRpc ¶
func (*AgentObj) DivisionRpc ¶
func (*AgentObj) GetPeerByName ¶
func (*AgentObj) IsConnected ¶
func (*AgentObj) RoundTripper ¶
func (a *AgentObj) RoundTripper() http.RoundTripper
type DbCursor ¶
type DbCursor struct {
// contains filtered or unexported fields
}
func NewDbCursor ¶
type DbWatchCallback ¶ added in v0.3.16
type PacketAnnounce ¶
type PacketClose ¶ added in v0.3.19
type PacketClose struct {
Reason string
}
type PacketDbRecord ¶
type PacketDbRequest ¶ added in v0.3.14
type PacketDbRequest struct { TargetId string SourceId string Bucket []byte // typically "app" Key []byte }
PacketDbRequest requests a specific record, response will be a PacketDbRecord
type PacketDbVersions ¶ added in v0.3.14
type PacketDbVersions struct {
Info []*PacketDbVersionsEntry
}
PacketDbVersions signals what records are available in a peer, typically sent on connection established
type PacketDbVersionsEntry ¶ added in v0.3.14
type PacketHandshake ¶
type PacketRpcResponse ¶
type PacketSeed ¶
type RpcEndpoint ¶
type RpcEndpoint func(interface{}) (interface{}, error)
type ServiceConn ¶
embed connection in a separate object to avoid confusing go's HTTP server (among other stuff)
type SortablePeers ¶
type SortablePeers []*Peer
func (SortablePeers) Len ¶
func (s SortablePeers) Len() int
func (SortablePeers) Less ¶
func (s SortablePeers) Less(i, j int) bool
func (SortablePeers) Swap ¶
func (s SortablePeers) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.