mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-16 11:39:57 +00:00
- **Wails v3 application** (`client/ui`) with a React + TypeScript + Tailwind frontend replacing the Fyne UI: main connection view, exit-node switcher, networks/peers browser with detail panels, profile management, settings (general, network, SSH, security, troubleshooting, appearance), debug-bundle creation, and a first-run welcome flow. - **Internationalization**: go-i18n bundle with 9 locales (en, de, es, fr, hu, it, pt, ru, zh-CN) shared between the tray and the frontend. - **New system tray** implementation with per-platform theme-aware icons, including a native XEmbed host for Linux (`xembed_tray_linux.c`) and a Linux theme watcher. - **Session handling**: auth session watcher (`client/internal/auth/sessionwatch`), pending login flow, session-expiration dialog and tray notifications, and `netbird login` improvements. - **Daemon API extensions** (`daemon.proto`): status stream subscription, event stream, networks/exit-node selection endpoints, and richer full status — with probe throttling on the daemon side to protect against UI-driven request storms. - **UI preferences store** persisted per profile, autostart management via the daemon (single source of truth in HKCU on Windows). - **Build system**: Taskfile-based builds per platform (macOS, Linux, Windows), Docker cross-compilation images, MSIX/NSIS/nfpm/AppImage packaging, and a new `frontend-ui` CI workflow. Co-authored-by: Zoltan Papp <zoltan.pmail@gmail.com> Co-authored-by: Eduard Gert <kontakt@eduardgert.de> Co-authored-by: braginini <bangvalo@gmail.com> Co-authored-by: Pascal Fischer <32096965+pascal-fischer@users.noreply.github.com> Co-authored-by: riccardom <riccardomanfrin@gmail.com>
89 lines
2.1 KiB
Go
89 lines
2.1 KiB
Go
//go:build !android && !ios && !freebsd && !js
|
|
|
|
package services
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/netbirdio/netbird/client/proto"
|
|
)
|
|
|
|
type Network struct {
|
|
ID string `json:"id"`
|
|
Range string `json:"range"`
|
|
Selected bool `json:"selected"`
|
|
Domains []string `json:"domains"`
|
|
ResolvedIPs map[string][]string `json:"resolvedIps"`
|
|
}
|
|
|
|
// SelectNetworksParams: All targets every available network; Append merges IDs into the existing selection.
|
|
type SelectNetworksParams struct {
|
|
NetworkIDs []string `json:"networkIds"`
|
|
Append bool `json:"append"`
|
|
All bool `json:"all"`
|
|
}
|
|
|
|
type Networks struct {
|
|
conn DaemonConn
|
|
}
|
|
|
|
func NewNetworks(conn DaemonConn) *Networks {
|
|
return &Networks{conn: conn}
|
|
}
|
|
|
|
func (s *Networks) List(ctx context.Context) ([]Network, error) {
|
|
cli, err := s.conn.Client()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp, err := cli.ListNetworks(ctx, &proto.ListNetworksRequest{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := make([]Network, 0, len(resp.GetRoutes()))
|
|
for _, n := range resp.GetRoutes() {
|
|
out = append(out, networkFromProto(n))
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (s *Networks) Select(ctx context.Context, p SelectNetworksParams) error {
|
|
cli, err := s.conn.Client()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = cli.SelectNetworks(ctx, &proto.SelectNetworksRequest{
|
|
NetworkIDs: p.NetworkIDs,
|
|
Append: p.Append,
|
|
All: p.All,
|
|
})
|
|
return err
|
|
}
|
|
|
|
func (s *Networks) Deselect(ctx context.Context, p SelectNetworksParams) error {
|
|
cli, err := s.conn.Client()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = cli.DeselectNetworks(ctx, &proto.SelectNetworksRequest{
|
|
NetworkIDs: p.NetworkIDs,
|
|
Append: p.Append,
|
|
All: p.All,
|
|
})
|
|
return err
|
|
}
|
|
|
|
func networkFromProto(n *proto.Network) Network {
|
|
resolved := make(map[string][]string, len(n.GetResolvedIPs()))
|
|
for k, v := range n.GetResolvedIPs() {
|
|
resolved[k] = append([]string{}, v.GetIps()...)
|
|
}
|
|
return Network{
|
|
ID: n.GetID(),
|
|
Range: n.GetRange(),
|
|
Selected: n.GetSelected(),
|
|
Domains: append([]string{}, n.GetDomains()...),
|
|
ResolvedIPs: resolved,
|
|
}
|
|
}
|