model

package
v0.0.0-prerelease Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package model contains the IPSW model for the database.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound  = errors.New("not found")
	ErrSymExists = errors.New("symbol exists")
)

Functions

This section is empty.

Types

type Device

type Device struct {
	Name string `gorm:"primaryKey" json:"name"`
}

type DyldSharedCache

type DyldSharedCache struct {
	UUID      string `gorm:"primaryKey" json:"uuid"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	SharedRegionStart uint64   `json:"shared_region_start,omitempty"`
	Images            []*Macho `gorm:"many2many:dsc_images;" json:"images,omitempty"`
}

DyldSharedCache is the model for a dyld_shared_cache.

type Entitlement

type Entitlement struct {
	ID      uint64 `gorm:"primaryKey" json:"id"`
	IpswID  string `gorm:"uniqueIndex:idx_unique_entitlement,priority:1;not null" json:"ipsw_id"`
	PathID  uint   `gorm:"uniqueIndex:idx_unique_entitlement,priority:2;not null" json:"path_id"`
	KeyID   uint   `gorm:"uniqueIndex:idx_unique_entitlement,priority:3;not null" json:"key_id"`
	ValueID uint   `gorm:"uniqueIndex:idx_unique_entitlement,priority:4;not null" json:"value_id"`

	// Foreign key relationships
	Ipsw  *Ipsw             `gorm:"foreignKey:IpswID" json:"ipsw,omitempty"`
	Path  *Path             `gorm:"foreignKey:PathID" json:"path,omitempty"`
	Key   *EntitlementKey   `gorm:"foreignKey:KeyID" json:"key,omitempty"`
	Value *EntitlementValue `gorm:"foreignKey:ValueID" json:"value,omitempty"`
}

Entitlement represents the mapping between keys, values, paths and IPSWs

func (Entitlement) TableName

func (Entitlement) TableName() string

TableName returns the table name for Entitlement

type EntitlementKey

type EntitlementKey struct {
	ID  uint   `gorm:"primaryKey" json:"id"`
	Key string `gorm:"type:text;uniqueIndex;not null" json:"key"`
}

EntitlementKey represents unique entitlement keys

func (EntitlementKey) TableName

func (EntitlementKey) TableName() string

TableName returns the table name for EntitlementKey

type EntitlementQuery

type EntitlementQuery struct {
	Version      string
	Build        string
	Device       string
	KeyPattern   string
	ValuePattern string
	FilePath     string
}

EntitlementQuery represents query parameters for searching entitlements

type EntitlementValue

type EntitlementValue struct {
	ID        uint   `gorm:"primaryKey" json:"id"`
	Value     string `gorm:"type:text;not null" json:"value"`
	ValueType string `gorm:"type:varchar(10);not null;check:value_type IN ('bool','string','array','dict','number')" json:"value_type"`
	ValueHash string `gorm:"type:char(16);uniqueIndex;not null" json:"value_hash"` // Shortened hash for uniqueness
}

EntitlementValue represents unique entitlement values with their types

func (EntitlementValue) TableName

func (EntitlementValue) TableName() string

TableName returns the table name for EntitlementValue

type Ipsw

type Ipsw struct {
	ID         string             `gorm:"primaryKey" json:"id"`
	Name       string             `json:"name,omitempty"`
	Version    string             `gorm:"index:idx_platform_version,priority:2" json:"version,omitempty"`
	BuildID    string             `gorm:"column:buildid" json:"buildid,omitempty"`
	Platform   Platform           `gorm:"type:varchar(20);index:idx_platform_version,priority:1" json:"platform,omitempty"`
	Devices    []*Device          `gorm:"many2many:ipsw_devices;" json:"devices,omitempty"`
	Kernels    []*Kernelcache     `gorm:"many2many:ipsw_kernels;" json:"kernels,omitempty"`
	DSCs       []*DyldSharedCache `gorm:"many2many:ipsw_dscs;" json:"dscs,omitempty"`
	FileSystem []*Macho           `gorm:"many2many:ipsw_files;" json:"file_system,omitempty"`

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

Ipsw is the model for an Ipsw file.

type Kernelcache

type Kernelcache struct {
	UUID      string         `gorm:"primaryKey" json:"uuid"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`

	Version string   `json:"version,omitempty"`
	Kexts   []*Macho `gorm:"many2many:kernelcache_kexts;" json:"kexts,omitempty"`
}

Kernelcache is the model for a kernelcache.

type Macho

type Macho struct {
	UUID string `gorm:"primaryKey" json:"uuid"`
	// swagger:ignore
	PathID    uint
	Path      Path      `gorm:"foreignKey:PathID"`
	TextStart uint64    `gorm:"type:bigint" json:"text_start,omitempty"`
	TextEnd   uint64    `gorm:"type:bigint" json:"text_end,omitempty"`
	Symbols   []*Symbol `gorm:"many2many:macho_syms;"`
}

func (Macho) GetPath

func (m Macho) GetPath() string

type Name

type Name struct {
	// swagger:ignore
	ID   uint   `gorm:"primaryKey"`
	Name string `gorm:"uniqueIndex" json:"name,omitempty"`
}

type Path

type Path struct {
	// swagger:ignore
	ID   uint   `gorm:"primaryKey" json:"id"`
	Path string `gorm:"uniqueIndex;not null" json:"path"`
}

type Platform

type Platform string

Platform represents supported Apple platforms

const (
	PlatformIOS      Platform = "iOS"
	PlatformMacOS    Platform = "macOS"
	PlatformWatchOS  Platform = "watchOS"
	PlatformTvOS     Platform = "tvOS"
	PlatformVisionOS Platform = "visionOS"
)

type Symbol

type Symbol struct {
	// swagger:ignore
	ID uint `gorm:"primaryKey"`
	// swagger:ignore
	NameID uint
	Name   Name   `gorm:"foreignKey:NameID"`
	Start  uint64 `gorm:"type:bigint" json:"start"`
	End    uint64 `gorm:"type:bigint" json:"end"`
}

swagger:model

func (Symbol) GetName

func (s Symbol) GetName() string

func (Symbol) String

func (s Symbol) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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