Files
Archive/mieru/pkg/appctl/proto/base.proto
T
2025-08-06 20:42:37 +02:00

137 lines
3.3 KiB
Protocol Buffer

// Copyright (C) 2024 mieru authors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
syntax = "proto3";
package mieru.appctl;
option go_package = "github.com/enfein/mieru/v3/pkg/appctl/appctlpb";
message AppStatusMsg {
optional AppStatus status = 1;
}
enum AppStatus {
UNKNOWN = 0;
// RPC service is available, but proxy is not started.
IDLE = 1;
// Proxy is starting.
STARTING = 2;
// Proxy is running.
RUNNING = 3;
// Proxy is being stopped.
STOPPING = 4;
}
enum LoggingLevel {
DEFAULT = 0;
FATAL = 1;
ERROR = 2;
WARN = 3;
INFO = 4;
DEBUG = 5;
TRACE = 6;
}
enum DualStack {
USE_FIRST_IP = 0;
PREFER_IPv4 = 1;
PREFER_IPv6 = 2;
ONLY_IPv4 = 3;
ONLY_IPv6 = 4;
}
message ServerEndpoint {
// String representation of IP address.
// It can be either IPv4 or IPv6.
optional string ipAddress = 1;
// Server's full qualified domain name.
// When this is set, the `ipAddress` field is ignored.
optional string domainName = 2;
// Server's port-protocol bindings.
repeated PortBinding portBindings = 3;
}
message PortBinding {
// A single port number.
// This field can't be set with portRange at the same time.
optional int32 port = 1;
optional TransportProtocol protocol = 2;
// A port number range.
// For example, "8000-9000" contains 1001 ports from 8000 to 9000.
// This field can't be set with port at the same time.
optional string portRange = 3;
}
enum TransportProtocol {
UNKNOWN_TRANSPORT_PROTOCOL = 0;
UDP = 1;
TCP = 2;
}
message User {
// User name is also the ID of user.
// Typically this is an email address.
optional string name = 1;
// Raw password.
// For safety this shouldn't be persisted at the server side.
optional string password = 2;
// Hashed password.
// Stored with hex encoding.
optional string hashedPassword = 3;
// User quotas.
// This field has no effect at the client side.
repeated Quota quotas = 4;
// Allow user to use private IP as the destination.
// This field has no effect at the client side.
optional bool allowPrivateIP = 5;
// Allow user to use loopback IP as the destination.
// This field has no effect at the client side.
optional bool allowLoopbackIP = 6;
}
message Quota {
// Number of days to renew the quota.
// The renew is rolling based.
optional int32 days = 1;
// Number of megabytes the user allowed to send and receive.
optional int32 megabytes = 2;
}
message Auth {
// Username used for authentication.
optional string user = 1;
// Password used for authentication.
optional string password = 2;
}