syncthing/protocol/packets.go

48 lines
962 B
Go
Raw Normal View History

2015-06-24 13:39:46 +02:00
// Copyright (C) 2015 Audrius Butkevicius and Contributors (see the CONTRIBUTORS file).
//go:generate -command genxdr go run ../../syncthing/Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go
//go:generate genxdr -o packets_xdr.go packets.go
package protocol
const (
2015-06-28 02:52:01 +02:00
messageTypePing int32 = iota
messageTypePong
messageTypeJoinRelayRequest
messageTypeJoinSessionRequest
messageTypeResponse
messageTypeConnectRequest
messageTypeSessionInvitation
2015-06-24 13:39:46 +02:00
)
2015-06-28 02:52:01 +02:00
type header struct {
magic uint32
messageType int32
messageLength int32
2015-06-24 13:39:46 +02:00
}
type Ping struct{}
type Pong struct{}
2015-06-28 02:52:01 +02:00
type JoinRelayRequest struct{}
type JoinSessionRequest struct {
Key []byte // max:32
}
type Response struct {
Code int32
Message string
}
2015-06-24 13:39:46 +02:00
type ConnectRequest struct {
ID []byte // max:32
}
type SessionInvitation struct {
2015-06-28 02:52:01 +02:00
From []byte // max:32
2015-06-24 13:39:46 +02:00
Key []byte // max:32
Address []byte // max:32
Port uint16
ServerSocket bool
}