database

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityLog

type ActivityLog struct {
	ID          int64  `json:"id"`
	ProfileID   int64  `json:"profile_id"`
	ProfileName string `json:"profile_name"`
	Action      string `json:"action"` // "created", "updated", "deleted", "started", "stopped"
	Details     string `json:"details"`
	Timestamp   string `json:"timestamp"` // ISO 8601 format
	Status      string `json:"status"`    // "success", "error"
}

ActivityLog represents a profile operation log entry

type DB

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

DB handles database operations

func New

func New() (*DB, error)

New creates a new database connection

func (*DB) AddActivityLog

func (db *DB) AddActivityLog(log *ActivityLog) error

AddActivityLog adds a new activity log entry

func (*DB) AddProfile

func (db *DB) AddProfile(p *Profile) error

AddProfile adds a new profile

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection

func (*DB) DeleteProfile

func (db *DB) DeleteProfile(id int64) error

DeleteProfile deletes a profile

func (*DB) GetActivityLogs

func (db *DB) GetActivityLogs(profileID *int64) ([]ActivityLog, error)

GetActivityLogs returns all activity logs, optionally filtered by profile ID

func (*DB) GetProfile

func (db *DB) GetProfile(id int64) (*Profile, error)

GetProfile returns a profile by ID

func (*DB) GetProfiles

func (db *DB) GetProfiles() ([]Profile, error)

GetProfiles returns all profiles

func (*DB) GetRecentActivityLogs

func (db *DB) GetRecentActivityLogs(limit int) ([]ActivityLog, error)

GetRecentActivityLogs returns the most recent activity logs (limited count)

func (*DB) UpdateProfile

func (db *DB) UpdateProfile(p *Profile) error

UpdateProfile updates an existing profile

type Profile

type Profile struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"` // "forward" or "reverse"
	Listen   string `json:"listen"`
	Remote   string `json:"remote"`
	Username string `json:"username"`
	Password string `json:"password"`
	Status   string `json:"status"` // "running" or "stopped"
}

Profile represents a GOST proxy profile

Jump to

Keyboard shortcuts

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