windows

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package windows HTTP 处理器

Package windows Windows 应用模块 (Wine)

Package windows Windows 服务

Package windows Windows 类型定义

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddAppRequest

type AddAppRequest struct {
	PrefixID string            `json:"prefix_id" binding:"required"`
	Name     string            `json:"name" binding:"required"`
	ExePath  string            `json:"exe_path" binding:"required"`
	WorkDir  string            `json:"work_dir,omitempty"`
	Args     []string          `json:"args,omitempty"`
	Env      map[string]string `json:"env,omitempty"`
}

AddAppRequest 添加应用请求

type App

type App struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	PrefixID    string            `json:"prefix_id"`
	ExePath     string            `json:"exe_path"`
	WorkDir     string            `json:"work_dir,omitempty"`
	Icon        string            `json:"icon,omitempty"`
	Args        []string          `json:"args,omitempty"`
	Env         map[string]string `json:"env,omitempty"`
	Status      AppStatus         `json:"status"`
	InstalledAt time.Time         `json:"installed_at"`
}

App Windows 应用

type AppStatus

type AppStatus string

AppStatus 应用状态

const (
	AppStatusStopped    AppStatus = "stopped"
	AppStatusRunning    AppStatus = "running"
	AppStatusInstalling AppStatus = "installing"
	AppStatusError      AppStatus = "error"
)

type CreatePrefixRequest

type CreatePrefixRequest struct {
	Name       string `json:"name" binding:"required"`
	Arch       string `json:"arch,omitempty"` // win32, win64
	WindowsVer string `json:"windows_version,omitempty"`
}

CreatePrefixRequest 创建前缀请求

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler HTTP 处理器

func NewHandler

func NewHandler(service *Service) *Handler

NewHandler 创建处理器实例

func (*Handler) AddApp

func (h *Handler) AddApp(c *gin.Context)

AddApp 添加应用

func (*Handler) CreatePrefix

func (h *Handler) CreatePrefix(c *gin.Context)

CreatePrefix 创建前缀

func (*Handler) DeleteApp

func (h *Handler) DeleteApp(c *gin.Context)

DeleteApp 删除应用

func (*Handler) DeletePrefix

func (h *Handler) DeletePrefix(c *gin.Context)

DeletePrefix 删除前缀

func (*Handler) GetApp

func (h *Handler) GetApp(c *gin.Context)

GetApp 获取应用

func (*Handler) GetApps

func (h *Handler) GetApps(c *gin.Context)

GetApps 获取应用列表

func (*Handler) GetPrefix

func (h *Handler) GetPrefix(c *gin.Context)

GetPrefix 获取前缀

func (*Handler) GetPrefixes

func (h *Handler) GetPrefixes(c *gin.Context)

GetPrefixes 获取前缀列表

func (*Handler) GetSessions

func (h *Handler) GetSessions(c *gin.Context)

GetSessions 获取会话列表

func (*Handler) GetStoreApps

func (h *Handler) GetStoreApps(c *gin.Context)

GetStoreApps 获取商店应用

func (*Handler) GetWineInfo

func (h *Handler) GetWineInfo(c *gin.Context)

GetWineInfo 获取 Wine 信息

func (*Handler) InstallApp

func (h *Handler) InstallApp(c *gin.Context)

InstallApp 安装应用

func (*Handler) LaunchApp

func (h *Handler) LaunchApp(c *gin.Context)

LaunchApp 启动应用

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(r *gin.RouterGroup)

RegisterRoutes 注册路由

func (*Handler) RunExe

func (h *Handler) RunExe(c *gin.Context)

RunExe 运行 EXE

func (*Handler) RunWinetricks

func (h *Handler) RunWinetricks(c *gin.Context)

RunWinetricks 运行 Winetricks

func (*Handler) StopSession

func (h *Handler) StopSession(c *gin.Context)

StopSession 停止会话

func (*Handler) UpdateApp

func (h *Handler) UpdateApp(c *gin.Context)

UpdateApp 更新应用

type InstallAppRequest

type InstallAppRequest struct {
	PrefixID      string `json:"prefix_id" binding:"required"`
	InstallerPath string `json:"installer_path" binding:"required"`
	Name          string `json:"name,omitempty"`
	Silent        bool   `json:"silent,omitempty"`
}

InstallAppRequest 安装应用请求

type LaunchRequest

type LaunchRequest struct {
	AppID string            `json:"app_id" binding:"required"`
	Args  []string          `json:"args,omitempty"`
	Env   map[string]string `json:"env,omitempty"`
}

LaunchRequest 启动请求

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module Windows 模块

func New

func New() *Module

New 创建模块实例

func (*Module) Dependencies

func (m *Module) Dependencies() []string

func (*Module) ID

func (m *Module) ID() string

func (*Module) Init

func (m *Module) Init(ctx *module.Context) error

Init 初始化模块

func (*Module) Name

func (m *Module) Name() string

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(group *gin.RouterGroup)

RegisterRoutes 注册路由

func (*Module) Start

func (m *Module) Start() error

Start 启动模块

func (*Module) Stop

func (m *Module) Stop() error

Stop 停止模块

func (*Module) Version

func (m *Module) Version() string

type RunExeRequest

type RunExeRequest struct {
	PrefixID string            `json:"prefix_id" binding:"required"`
	ExePath  string            `json:"exe_path" binding:"required"`
	Args     []string          `json:"args,omitempty"`
	Env      map[string]string `json:"env,omitempty"`
}

RunExeRequest 运行 EXE 请求

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service Windows 服务

func NewService

func NewService(logger *zap.Logger, dataDir string) *Service

NewService 创建服务实例

func (*Service) AddApp

func (s *Service) AddApp(req AddAppRequest) (*App, error)

AddApp 添加应用

func (*Service) CreatePrefix

func (s *Service) CreatePrefix(req CreatePrefixRequest) (*WinePrefix, error)

CreatePrefix 创建前缀

func (*Service) DeleteApp

func (s *Service) DeleteApp(id string) error

DeleteApp 删除应用

func (*Service) DeletePrefix

func (s *Service) DeletePrefix(id string) error

DeletePrefix 删除前缀

func (*Service) GetApp

func (s *Service) GetApp(id string) (*App, error)

GetApp 获取应用

func (*Service) GetApps

func (s *Service) GetApps(prefixID string) []*App

GetApps 获取应用列表

func (*Service) GetPrefix

func (s *Service) GetPrefix(id string) (*WinePrefix, error)

GetPrefix 获取前缀

func (*Service) GetPrefixes

func (s *Service) GetPrefixes() []*WinePrefix

GetPrefixes 获取前缀列表

func (*Service) GetSessions

func (s *Service) GetSessions() []*Session

GetSessions 获取会话列表

func (*Service) GetStoreApps

func (s *Service) GetStoreApps() []StoreApp

GetStoreApps 获取商店应用

func (*Service) GetWineInfo

func (s *Service) GetWineInfo() *WineInfo

GetWineInfo 获取 Wine 信息

func (*Service) InstallApp

func (s *Service) InstallApp(req InstallAppRequest) (*App, error)

InstallApp 安装应用

func (*Service) LaunchApp

func (s *Service) LaunchApp(req LaunchRequest) (*Session, error)

LaunchApp 启动应用

func (*Service) RunExe

func (s *Service) RunExe(req RunExeRequest) (*Session, error)

RunExe 运行 EXE

func (*Service) RunWinetricks

func (s *Service) RunWinetricks(req WinetricksRequest) error

RunWinetricks 运行 Winetricks

func (*Service) Start

func (s *Service) Start() error

Start 启动服务

func (*Service) Stop

func (s *Service) Stop()

Stop 停止服务

func (*Service) StopSession

func (s *Service) StopSession(id string) error

StopSession 停止会话

func (*Service) UpdateApp

func (s *Service) UpdateApp(id string, req UpdateAppRequest) (*App, error)

UpdateApp 更新应用

type Session

type Session struct {
	ID        string    `json:"id"`
	AppID     string    `json:"app_id"`
	AppName   string    `json:"app_name"`
	PrefixID  string    `json:"prefix_id"`
	PID       int       `json:"pid"`
	Display   int       `json:"display"`
	Port      int       `json:"port"`
	Status    AppStatus `json:"status"`
	StartedAt time.Time `json:"started_at"`
}

Session 运行会话

type StoreApp

type StoreApp struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Icon        string   `json:"icon,omitempty"`
	Category    string   `json:"category,omitempty"`
	Version     string   `json:"version,omitempty"`
	Source      string   `json:"source,omitempty"`
	Script      string   `json:"script,omitempty"`
	Verbs       []string `json:"verbs,omitempty"`
}

StoreApp 应用商店应用

type UpdateAppRequest

type UpdateAppRequest struct {
	Name    string            `json:"name,omitempty"`
	ExePath string            `json:"exe_path,omitempty"`
	WorkDir string            `json:"work_dir,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
}

UpdateAppRequest 更新应用请求

type WineConfig

type WineConfig struct {
	WindowsVersion string `json:"windows_version"`
	DPI            int    `json:"dpi"`
	VirtualDesktop string `json:"virtual_desktop,omitempty"` // 1024x768
	DXVK           bool   `json:"dxvk"`
	VKD3D          bool   `json:"vkd3d"`
	Gallium9       bool   `json:"gallium9"`
}

WineConfig Wine 配置

type WineInfo

type WineInfo struct {
	Version       string `json:"version"`
	Path          string `json:"path"`
	Arch          string `json:"arch"`
	WinetricksVer string `json:"winetricks_version,omitempty"`
	DXVKVersion   string `json:"dxvk_version,omitempty"`
}

WineInfo Wine 信息

type WinePrefix

type WinePrefix struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	Path       string    `json:"path"`
	Arch       string    `json:"arch"` // win32, win64
	WindowsVer string    `json:"windows_version,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	Size       int64     `json:"size,omitempty"`
}

WinePrefix Wine 前缀

type WinetricksRequest

type WinetricksRequest struct {
	PrefixID string   `json:"prefix_id" binding:"required"`
	Verbs    []string `json:"verbs" binding:"required"`
}

WinetricksRequest Winetricks 请求

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL