Files
Archive/mieru/pkg/appctl/proto/base.proto
T
2025-04-01 20:37:32 +02:00

141 lines
3.2 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 appctl;
option go_package = "github.com/enfein/mieru/v3/pkg/appctl/appctlpb";
message Empty {}
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;
}
enum Cipher {
CIPHER_DEFAULT = 0;
CIPHER_XCHACHA20_POLY1305 = 1;
CIPHER_AES_128_GCM = 2;
CIPHER_AES_256_GCM = 3;
}
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 has no effect at the client side.
repeated Quota quotas = 4;
// Encryption and decryption algorithm.
optional Cipher cipher = 5;
}
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;
}