lux/rpc/lux_rpc_data.go
2025-01-22 15:20:34 +02:00

87 lines
1.9 KiB
Go

package rpc
import "encoding/xml"
type LuxRpcWAN struct {
XMLName xml.Name `xml:"wan"`
Addr4 string `xml:"addr4"`
Addr6 string `xml:"addr6"`
}
type LuxRpcOption struct {
XMLName xml.Name `xml:"option"`
Type int `xml:"type,attr"`
Blob string `xml:",innerxml"`
}
type LuxRpcState struct {
XMLName xml.Name `xml:"state"`
WAN LuxRpcWAN `xml:"wan"`
Options []LuxRpcOption `xml:"option"`
}
type LuxRpcHost struct {
XMLName xml.Name `xml:"host"`
HostID string `xml:"id,attr"`
Hostname string `xml:"hostname,attr"`
StateBlob string `xml:"state"`
}
type LuxRpcRequest struct {
XMLName xml.Name `xml:"request"`
RequestID int `xml:"id,attr"`
Controller string `xml:"controller,attr"`
Command string `xml:"command,attr"`
// Command-specific fields
Hosts []LuxRpcHost `xml:"host"`
}
type LuxRpcKeyNode struct {
XMLName xml.Name `xml:"node"`
ID string `xml:"id,attr"`
KeyBlob string `xml:"key"`
IVBlob string `xml:"iv"`
}
type LuxRpcKeyHost struct {
XMLName xml.Name `xml:"host"`
ID string `xml:"id,attr"`
KeyBlob string `xml:"key"`
IVBlob string `xml:"iv"`
}
type LuxRpcKeyStore struct {
XMLName xml.Name `xml:"keystore"`
Nodes []LuxRpcKeyNode `xml:"node"`
Hosts []LuxRpcKeyHost `xml:"host"`
}
type LuxRpcRoute struct {
XMLName xml.Name `xml:"route"`
Type int `xml:"type,attr"`
Target string `xml:"target"`
Source string `xml:"source"`
Destination string `xml:"destination"`
}
type LuxRpcResponse struct {
XMLName xml.Name `xml:"response"`
RequestID int `xml:"id,attr"`
// Command-specific fields
Keystore LuxRpcKeyStore `xml:"keystore"`
Routes []LuxRpcRoute `xml:"route"`
Hosts []LuxRpcHost `xml:"host"`
}
type LuxRpcError struct {
XMLName xml.Name `xml:"error"`
RequestID int `xml:"id,attr"`
ErrorCode int `xml:"code,attr"`
Message string `xml:",innerxml"`
}