Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ lint:
# AWG_PREPARE_STATE_NONE is already in the API; renaming it would change the JSON the clients send and read.
ENUM_ZERO_VALUE_SUFFIX:
- proto/mistgate/admin/v1/node.proto
# The messages of the people's bot are shared between calls on purpose: every message type is code and descriptor in each Worker
# that serves the service (scripts/check-edge-sizes.sh). See the header of the file.
RPC_REQUEST_STANDARD_NAME:
- proto/mistgate/usernotify/v1/usernotify.proto
RPC_RESPONSE_STANDARD_NAME:
- proto/mistgate/usernotify/v1/usernotify.proto
RPC_REQUEST_RESPONSE_UNIQUE:
- proto/mistgate/usernotify/v1/usernotify.proto
breaking:
use: [FILE]
2 changes: 2 additions & 0 deletions cmd/mistgate-edge-admin/main_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/mistgate/mistgate/edge/bridge"
"github.com/mistgate/mistgate/internal/panel/app"
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
)

func main() {
Expand All @@ -19,5 +20,6 @@ func main() {
// buildAdmin is app.BuildAdmin with the ProposalService plugged in (app.Config.ProposalAPI).
func buildAdmin(c app.Config) (*app.Panel, error) {
c.ProposalAPI = proposalrpc.Handler
c.UserNotifyAPI = usernotifyrpc.Handler
return app.BuildAdmin(c)
}
2 changes: 2 additions & 0 deletions cmd/mistgate-edge/main_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/mistgate/mistgate/edge/bridge"
"github.com/mistgate/mistgate/internal/panel/app"
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
)

func main() {
Expand All @@ -21,5 +22,6 @@ func main() {
// that the Workers that do not serve it never link it.
func buildAll(c app.Config) (*app.Panel, error) {
c.ProposalAPI = proposalrpc.Handler
c.UserNotifyAPI = usernotifyrpc.Handler
return app.Build(c)
}
4 changes: 3 additions & 1 deletion cmd/mistgate-edge/testdata/vps-oracle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/mistgate/mistgate/internal/panel/auth"
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/store"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
"github.com/mistgate/mistgate/internal/panel/vault"
)

Expand Down Expand Up @@ -49,7 +50,8 @@ func main() {
built, err := app.Build(app.Config{
Store: st, Vault: vlt, Auth: authSvc, MasterKey: key, Clock: time.Now, Logger: log,
Instance: in, Title: "Mistgate", DataDir: filepath.Join(filepath.Dir(os.Args[1]), "backup-unavailable"),
ProposalAPI: proposalrpc.Handler,
ProposalAPI: proposalrpc.Handler,
UserNotifyAPI: usernotifyrpc.Handler,
})
if err != nil {
fatal(err)
Expand Down
4 changes: 3 additions & 1 deletion cmd/mistgate/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
nodeprovision "github.com/mistgate/mistgate/internal/panel/provision"
"github.com/mistgate/mistgate/internal/panel/store"
"github.com/mistgate/mistgate/internal/panel/telegram"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
"github.com/mistgate/mistgate/internal/panel/update"
"github.com/mistgate/mistgate/internal/panel/vault"
"github.com/mistgate/mistgate/internal/panel/warp"
Expand Down Expand Up @@ -78,7 +79,8 @@ func newPanel(st *store.Store, vlt *vault.Vault, authSvc *auth.Service, o panelO
},
DecoyDir: o.decoyDir, PanelAddr: o.panelAddr, DataDir: o.dataDir,
UpdateService: o.updateService, Title: o.title, HealthBlipWindow: healthBlipWindow, Ops: o.ops,
ProposalAPI: proposalrpc.Handler,
ProposalAPI: proposalrpc.Handler,
UserNotifyAPI: usernotifyrpc.Handler,
})
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions docs/en/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The API is defined in `proto/mistgate/admin/v1/`. Generated code is in the repos
| `BackupService` | `backup.proto` | Encrypted panel backups |
| `TrustTunnelService` | `trusttunnel.proto` | A person's TrustTunnel key and `tt://` links (package `mistgate.trusttunnel.v1`; the admin's write level, closed to API tokens and MCP) |
| `TelegramService` | `telegram.proto` | The Telegram bot and each admin's chat (owner and signed-in admins only; closed to API tokens and MCP) |
| `UserNotifyService` | `usernotify.proto` (package `mistgate.usernotify.v1`) | The separate Telegram bot that tells users about their access, and each user's chats: link codes, mute, unlink, the chat limit (signed-in admins; the bot and the limit are the owner's, and setting or clearing the bot needs a step-up; closed to API tokens and MCP) |
| `ApiTokenService`, `ApprovalService` | `integrations.proto` | API tokens and the owner's approvals |
| `CheburcheckService`, `BsbordService` | `cheburcheck.proto`, `bsbord.proto` | The cheburcheck and bsbord sources of the [country check](../operations/reachability.md): settings, status and test, and for bsbord the unit list and the price check (owner only; changing or disconnecting a source, and the price check, need a step-up; closed to API tokens and MCP) |

Expand Down
1 change: 1 addition & 0 deletions docs/ru/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ API описан в `proto/mistgate/admin/v1/`. Сгенерированный
| `BackupService` | `backup.proto` | Зашифрованные бэкапы панели |
| `TrustTunnelService` | `trusttunnel.proto` | Ключ TrustTunnel человека и ссылки `tt://` (пакет `mistgate.trusttunnel.v1`; уровень записи админа, закрыт для токенов API и MCP) |
| `TelegramService` | `telegram.proto` | Telegram-бот и чат каждого админа (только владелец и вошедшие админы; закрыт для токенов API и MCP) |
| `UserNotifyService` | `usernotify.proto` (пакет `mistgate.usernotify.v1`) | Отдельный Telegram-бот, который пишет людям об их доступе, и чаты каждого человека: коды привязки, отключение уведомлений, отвязка, лимит чатов (вошедшие админы; бот и лимит — только у владельца, смена и сброс бота требуют повторного подтверждения; закрыт для токенов API и MCP) |
| `ApiTokenService`, `ApprovalService` | `integrations.proto` | API-токены и одобрения владельца |
| `CheburcheckService`, `BsbordService` | `cheburcheck.proto`, `bsbord.proto` | Источники cheburcheck и bsbord [проверки из страны](../operations/reachability.md): настройки, статус и проверка, а у bsbord ещё список единиц и запрос цены (только владелец; изменение и отключение источника и запрос цены требуют повторного подтверждения; закрыт для токенов API и MCP) |

Expand Down
1 change: 1 addition & 0 deletions docs/zh/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ API 定义位于 `proto/mistgate/admin/v1/`。生成的代码也在仓库中:G
| `BackupService` | `backup.proto` | 面板加密备份 |
| `TrustTunnelService` | `trusttunnel.proto` | 用户的 TrustTunnel 密钥和 `tt://` 链接(包 `mistgate.trusttunnel.v1`;管理员写入级别,对 API 令牌和 MCP 关闭) |
| `TelegramService` | `telegram.proto` | Telegram 机器人和各管理员的聊天(仅所有者和已登录的管理员可用;API 令牌和 MCP 无法访问) |
| `UserNotifyService` | `usernotify.proto`(包 `mistgate.usernotify.v1`) | 向用户通知其访问情况的独立 Telegram 机器人,以及每位用户的聊天:绑定码、静音、解绑、聊天上限(已登录的管理员可用;机器人及其上限仅所有者可设置,更换或清除机器人需要再次验证;API 令牌和 MCP 无法访问) |
| `ApiTokenService`, `ApprovalService` | `integrations.proto` | API 令牌和所有者审批 |
| `CheburcheckService`, `BsbordService` | `cheburcheck.proto`, `bsbord.proto` | [国家视角检测](../operations/reachability.md)的 cheburcheck 和 bsbord 来源:设置、状态和测试,bsbord 另有单元列表和价格查询(仅所有者;更改或断开来源以及价格查询需要再次验证;API 令牌和 MCP 无法访问) |

Expand Down
3 changes: 3 additions & 0 deletions edge/bridge/cron_js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/mistgate/mistgate/internal/panel/health"
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/store"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
"github.com/mistgate/mistgate/internal/panel/vault"
)

Expand Down Expand Up @@ -99,6 +100,7 @@ func TestCronOpRunsEdgeTickAndReleasesFanout(t *testing.T) {
RPOrigins: []string{"https://example.com"}, AgentSNI: "agent.example.com", SubPrefix: "/sub/",
},
Remote: remote, AfterResponse: runner.Run, ProposalAPI: proposalrpc.Handler,
UserNotifyAPI: usernotifyrpc.Handler,
})
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -256,6 +258,7 @@ func TestCronConcurrentTicksShareOneCountryRound(t *testing.T) {
RPOrigins: []string{"https://example.com"}, AgentSNI: "agent.example.com", SubPrefix: "/sub/",
},
Remote: &cronTestRemote{}, AfterResponse: afterResponse, ProposalAPI: proposalrpc.Handler,
UserNotifyAPI: usernotifyrpc.Handler,
})
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 2 additions & 0 deletions edge/bridge/proposals_js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/mistgate/mistgate/internal/panel/auth"
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/store"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
"github.com/mistgate/mistgate/internal/panel/vault"
)

Expand Down Expand Up @@ -51,6 +52,7 @@ func TestCronProposalsWorkCost(t *testing.T) {
RPOrigins: []string{"https://example.com"}, AgentSNI: "agent.example.com", SubPrefix: "/sub/",
},
Remote: &cronTestRemote{}, AfterResponse: runner.Run, ProposalAPI: proposalrpc.Handler,
UserNotifyAPI: usernotifyrpc.Handler,
})
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 2 additions & 0 deletions edge/bridge/role_js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package bridge
import (
"github.com/mistgate/mistgate/internal/panel/app"
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
)

// The tests run the role with every operation, as cmd/mistgate-edge does: the whole panel (with the ProposalService plugged in,
Expand All @@ -13,6 +14,7 @@ import (
func init() {
active = Role{Name: "all", Build: func(c app.Config) (*app.Panel, error) {
c.ProposalAPI = proposalrpc.Handler
c.UserNotifyAPI = usernotifyrpc.Handler
return app.Build(c)
}, Auth: true, CreatesInstance: true}
provisioner = sshProvisioner
Expand Down
2 changes: 2 additions & 0 deletions edge/bridge/silent_js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/mistgate/mistgate/internal/panel/proposal/proposalrpc"
"github.com/mistgate/mistgate/internal/panel/protocols/builtin"
"github.com/mistgate/mistgate/internal/panel/store"
"github.com/mistgate/mistgate/internal/panel/telegram/usernotifyrpc"
"github.com/mistgate/mistgate/internal/panel/vault"
)

Expand Down Expand Up @@ -62,6 +63,7 @@ func silentCalls(t *testing.T, detector bool, setup func(ctx context.Context, t
RPOrigins: []string{"https://example.com"}, AgentSNI: "agent.example.com", SubPrefix: "/sub/",
},
Remote: &cronTestRemote{}, AfterResponse: newEdgeTaskRunner().Run, ProposalAPI: proposalrpc.Handler,
UserNotifyAPI: usernotifyrpc.Handler,
})
if err != nil {
t.Fatal(err)
Expand Down
Loading
Loading