mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
Add AppendXDR to XDR types, build.sh xdr
This commit is contained in:
parent
b7ea695caf
commit
e937e51476
11
build.sh
11
build.sh
@ -98,6 +98,13 @@ setup() {
|
|||||||
go get -u code.google.com/p/go.tools/cmd/vet
|
go get -u code.google.com/p/go.tools/cmd/vet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xdr() {
|
||||||
|
go install ./xdr/cmd/genxdr
|
||||||
|
for f in discover/packets files/leveldb protocol/message scanner/blocks scanner/file ; do
|
||||||
|
genxdr "${f}.go" > "${f}_xdr.go"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"")
|
"")
|
||||||
shift
|
shift
|
||||||
@ -201,6 +208,10 @@ case "$1" in
|
|||||||
setup
|
setup
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
xdr)
|
||||||
|
xdr
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Unknown build parameter $1"
|
echo "Unknown build parameter $1"
|
||||||
;;
|
;;
|
||||||
|
@ -13,7 +13,11 @@ func (o QueryV2) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o QueryV2) MarshalXDR() []byte {
|
func (o QueryV2) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o QueryV2) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -51,7 +55,11 @@ func (o AnnounceV2) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o AnnounceV2) MarshalXDR() []byte {
|
func (o AnnounceV2) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o AnnounceV2) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -101,7 +109,11 @@ func (o Node) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o Node) MarshalXDR() []byte {
|
func (o Node) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o Node) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -152,7 +164,11 @@ func (o Address) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o Address) MarshalXDR() []byte {
|
func (o Address) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o Address) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
|
@ -13,7 +13,11 @@ func (o fileVersion) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o fileVersion) MarshalXDR() []byte {
|
func (o fileVersion) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o fileVersion) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -48,7 +52,11 @@ func (o versionList) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o versionList) MarshalXDR() []byte {
|
func (o versionList) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o versionList) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
|
@ -13,7 +13,11 @@ func (o IndexMessage) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o IndexMessage) MarshalXDR() []byte {
|
func (o IndexMessage) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o IndexMessage) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -64,7 +68,11 @@ func (o FileInfo) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o FileInfo) MarshalXDR() []byte {
|
func (o FileInfo) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o FileInfo) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -121,7 +129,11 @@ func (o BlockInfo) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o BlockInfo) MarshalXDR() []byte {
|
func (o BlockInfo) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o BlockInfo) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -159,7 +171,11 @@ func (o RequestMessage) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o RequestMessage) MarshalXDR() []byte {
|
func (o RequestMessage) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o RequestMessage) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -204,7 +220,11 @@ func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o ClusterConfigMessage) MarshalXDR() []byte {
|
func (o ClusterConfigMessage) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o ClusterConfigMessage) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -275,7 +295,11 @@ func (o Repository) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o Repository) MarshalXDR() []byte {
|
func (o Repository) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o Repository) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -326,7 +350,11 @@ func (o Node) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o Node) MarshalXDR() []byte {
|
func (o Node) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o Node) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
@ -366,7 +394,11 @@ func (o Option) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o Option) MarshalXDR() []byte {
|
func (o Option) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o Option) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
||||||
|
@ -13,10 +13,14 @@ func (o Block) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o Block) MarshalXDR() []byte {
|
func (o Block) MarshalXDR() []byte {
|
||||||
var buf bytes.Buffer
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
var xw = xdr.NewWriter(&buf)
|
}
|
||||||
|
|
||||||
|
func (o Block) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return buf.Bytes()
|
return []byte(aw)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o Block) encodeXDR(xw *xdr.Writer) (int, error) {
|
func (o Block) encodeXDR(xw *xdr.Writer) (int, error) {
|
||||||
@ -32,8 +36,8 @@ func (o *Block) DecodeXDR(r io.Reader) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *Block) UnmarshalXDR(bs []byte) error {
|
func (o *Block) UnmarshalXDR(bs []byte) error {
|
||||||
var buf = bytes.NewBuffer(bs)
|
var br = bytes.NewReader(bs)
|
||||||
var xr = xdr.NewReader(buf)
|
var xr = xdr.NewReader(br)
|
||||||
return o.decodeXDR(xr)
|
return o.decodeXDR(xr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,14 @@ func (o File) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o File) MarshalXDR() []byte {
|
func (o File) MarshalXDR() []byte {
|
||||||
var buf bytes.Buffer
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
var xw = xdr.NewWriter(&buf)
|
}
|
||||||
|
|
||||||
|
func (o File) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return buf.Bytes()
|
return []byte(aw)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o File) encodeXDR(xw *xdr.Writer) (int, error) {
|
func (o File) encodeXDR(xw *xdr.Writer) (int, error) {
|
||||||
@ -39,8 +43,8 @@ func (o *File) DecodeXDR(r io.Reader) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *File) UnmarshalXDR(bs []byte) error {
|
func (o *File) UnmarshalXDR(bs []byte) error {
|
||||||
var buf = bytes.NewBuffer(bs)
|
var br = bytes.NewReader(bs)
|
||||||
var xr = xdr.NewReader(buf)
|
var xr = xdr.NewReader(br)
|
||||||
return o.decodeXDR(xr)
|
return o.decodeXDR(xr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,11 @@ func (o {{.TypeName}}) EncodeXDR(w io.Writer) (int, error) {
|
|||||||
}//+n
|
}//+n
|
||||||
|
|
||||||
func (o {{.TypeName}}) MarshalXDR() []byte {
|
func (o {{.TypeName}}) MarshalXDR() []byte {
|
||||||
var aw = make(xdr.AppendWriter, 0, 128)
|
return o.AppendXDR(make([]byte, 0, 128))
|
||||||
|
}//+n
|
||||||
|
|
||||||
|
func (o {{.TypeName}}) AppendXDR(bs []byte) []byte {
|
||||||
|
var aw = xdr.AppendWriter(bs)
|
||||||
var xw = xdr.NewWriter(&aw)
|
var xw = xdr.NewWriter(&aw)
|
||||||
o.encodeXDR(xw)
|
o.encodeXDR(xw)
|
||||||
return []byte(aw)
|
return []byte(aw)
|
Loading…
Reference in New Issue
Block a user