/
githubmirror
/
syncthing
Обзор
Документация
Войти
/
githubmirror
/
syncthing
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
lib/relay/protocol/packets.go
72 строки
1 KB
Jakob Borg
build: use Go 1.24 tools pattern (#10281)
24 авг 2025, 15:17
Не верифицирован
24 авг 2025, 15:17
01257e8
Код
Авторство
О чём код?
// Copyright (C) 2015 Audrius Butkevicius and Contributors (see the CONTRIBUTORS file). //go:generate go tool genxdr -o packets_xdr.go packets.go package protocol import ( "fmt" "net" "github.com/syncthing/syncthing/lib/protocol" ) const ( messageTypePing int32 = iota messageTypePong messageTypeJoinRelayRequest messageTypeJoinSessionRequest messageTypeResponse messageTypeConnectRequest messageTypeSessionInvitation messageTypeRelayFull ) type header struct { magic uint32 messageType int32 messageLength int32 } type ( Ping struct{} Pong struct{} RelayFull struct{} ) type JoinRelayRequest struct { Token string } type JoinSessionRequest struct { Key []byte // max:32 } type Response struct { Code int32 Message string } type ConnectRequest struct { ID []byte // max:32 } type SessionInvitation struct { From []byte // max:32 Key []byte // max:32 Address []byte // max:32 Port uint16 ServerSocket bool } func (i SessionInvitation) String() string { device := "<invalid>" if address, err := protocol.DeviceIDFromBytes(i.From); err == nil { device = address.String() } return fmt.Sprintf("%s@%s:%d", device, net.IP(i.Address), i.Port) } func (i SessionInvitation) GoString() string { return i.String() }