protocol: Add "Hello" message at connection start, also for unauthed peers

This commit is contained in:
Audrius Butkevicius
2016-03-25 20:29:07 +00:00
parent 1d17891286
commit b4f9a55e6e
9 changed files with 267 additions and 139 deletions

View File

@@ -11,7 +11,16 @@ import (
"fmt"
)
var sha256OfEmptyBlock = sha256.Sum256(make([]byte, BlockSize))
var (
sha256OfEmptyBlock = sha256.Sum256(make([]byte, BlockSize))
HelloMessageMagic uint32 = 0x9F79BC40
)
type HelloMessage struct {
DeviceName string // max:64
ClientName string // max:64
ClientVersion string // max:64
}
type IndexMessage struct {
Folder string // max:256
@@ -125,11 +134,8 @@ type ResponseMessage struct {
}
type ClusterConfigMessage struct {
DeviceName string // max:64
ClientName string // max:64
ClientVersion string // max:64
Folders []Folder // max:1000000
Options []Option // max:64
Folders []Folder // max:1000000
Options []Option // max:64
}
func (o *ClusterConfigMessage) GetOption(key string) string {