Domain
Golang Distributed System and Home Automation
Purpose
This library serves on an IoT network were services (lights, speakers, thermostat, cameras, processing...) will be auto-started, auto-distributed, and (maybe) auto-scaled. domain is the back bone of this process. Once a domain starts it will start its own services, enable service discovery and distribution, and communicate about which services it still needs.
Domains search for other domains (peers) by:
- Identifying that they are lonely (either can't heartbeat to them or had no peers to begin with)
- Broadcasting to the network using ZeroConf (advertizing a service with config.Title)
- Listening for incomming RPCs (ShareIdentityList() is the heartbeat rpc)
- Processing incomming identity lists by updating its peerMap
Domains listen for other domains (peers) by:
- Listening for ZeroConf broadcasts (with service matching config.Title)
- Sending ShareIdentityList RPCs to the lonely domain
- Adding the new domain to its peerMap
Domains maintain contact with other domains (peers) by:
- Checking to see if most recent contact is too old
- Checking and possible establishing a new connection with the domain (peer)
- Sending ShareIdentityList RPCs to the domain (peer)
- Processing the replied identity list by updating its peerMap
Domains processing identity lists by:
- Adding new identities as peers without connections
- Updating current peers information, like IP, Port, LastContact, and ServiceList
Utilized Libraries
github.com/blang/semver
google.golang.org/grpc
github.com/grandcat/zeroconf
github.com/BurntSushi/toml
Planned Development
- Service Sharing - strategies for service start and service dependency evaluation
- Connection encryption - encrypt RPCs
- Identity verification - sign communication with preestablished keypairs