talos/api/network/api.proto
Andrew Rynhard 6efd6fbe08 chore: move gRPC API to public
In order for other projects to make use of our APIs, they must not
reside underneath the internal directory. This moves the protobuf
definitions to a top-level "api" directory and scopes them according to
their domain. This change also removes generated code from the gitignore
file so that users don't have to generate the code themseleves.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2019-09-19 08:55:13 -07:00

95 lines
2.8 KiB
Protocol Buffer

syntax = "proto3";
package proto;
option go_package = "proto";
option java_multiple_files = true;
option java_outer_classname = "ApiProto";
option java_package = "com.proto";
import "google/protobuf/empty.proto";
// The Init service definition.
service Networkd {
rpc Routes(google.protobuf.Empty) returns (RoutesReply);
rpc Interfaces(google.protobuf.Empty) returns (InterfacesReply);
}
enum AddressFamily {
option allow_alias = true;
AF_UNSPEC = 0;
AF_INET = 2;
IPV4 = 2;
AF_INET6 = 10;
IPV6 = 10;
}
enum RouteProtocol {
RTPROT_UNSPEC = 0;
RTPROT_REDIRECT = 1; // Route installed by ICMP redirects
RTPROT_KERNEL = 2; // Route installed by kernel
RTPROT_BOOT = 3; // Route installed during boot
RTPROT_STATIC = 4; // Route installed by administrator
RTPROT_GATED = 8; // Route installed by gated
RTPROT_RA = 9; // Route installed by router advertisement
RTPROT_MRT = 10; // Route installed by Merit MRT
RTPROT_ZEBRA = 11; // Route installed by Zebra/Quagga
RTPROT_BIRD = 12; // Route installed by Bird
RTPROT_DNROUTED = 13; // Route installed by DECnet routing daemon
RTPROT_XORP = 14; // Route installed by XORP
RTPROT_NTK = 15; // Route installed by Netsukuku
RTPROT_DHCP = 16; // Route installed by DHCP
RTPROT_MROUTED = 17; // Route installed by Multicast daemon
RTPROT_BABEL = 42; // Route installed by Babel daemon
}
enum InterfaceFlags {
FLAG_UNKNOWN = 0;
FLAG_UP = 1;
FLAG_BROADCAST = 2;
FLAG_LOOPBACK = 3;
FLAG_POINT_TO_POINT = 4;
FLAG_MULTICAST = 5;
}
// The response message containing the routes.
message RoutesReply {
repeated Route routes = 1;
}
// The response message containing a route.
message Route {
// Interface is the interface over which traffic to this destination should be sent
string interface = 1;
// Destination is the network prefix CIDR which this route provides
string destination = 2;
// Gateway is the gateway address to which traffic to this destination should be sent
string gateway = 3;
// Metric is the priority of the route, where lower metrics have higher priorities
uint32 metric = 4;
// Scope desribes the scope of this route
uint32 scope = 5;
// Source is the source prefix CIDR for the route, if one is defined
string source = 6;
// Family is the address family of the route. Currently, the only options are AF_INET (IPV4) and AF_INET6 (IPV6).
AddressFamily family = 7;
// Protocol is the protocol by which this route came to be in place
RouteProtocol protocol = 8;
// Flags indicate any special flags on the route
uint32 flags = 9;
}
message InterfacesReply {
repeated Interface interfaces = 1;
}
// Interface represents a net.Interface
message Interface {
uint32 index = 1;
uint32 mtu = 2;
string name = 3;
string hardwareaddr = 4;
InterfaceFlags flags = 5;
repeated string ipaddress = 6;
}