entity

package
v0.0.0-...-42cc326 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostMethodUnknown = 0
	HostMethodManual  = 1
	HostMethodUPNP    = 2
	HostMethodMITM    = 3
)

The enum values for HostMethod.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostMethod

type HostMethod int64

HostMethod is the enum for the hosting method.

type Session

type Session struct {
	ID                  string     `json:"-" gorm:"primary_key;size:64"`
	ContentHash         string     `json:"-" gorm:"size:64"`
	RoomID              int32      `json:"id" gorm:"AUTO_INCREMENT;unique_index"`
	Username            string     `json:"username"`
	Country             string     `json:"country" gorm:"size:2"`
	GameName            string     `json:"game_name"`
	GameCRC             string     `json:"game_crc"`
	CoreName            string     `json:"core_name"`
	CoreVersion         string     `json:"core_version"`
	SubsystemName       string     `json:"subsystem_name"`
	RetroArchVersion    string     `json:"retroarch_version"`
	Frontend            string     `json:"frontend"`
	IP                  net.IP     `json:"ip" gorm:"not null"`
	Port                uint16     `json:"port"`
	MitmHandle          string     `json:"-"`
	MitmAddress         string     `json:"mitm_ip"`
	MitmPort            uint16     `json:"mitm_port"`
	MitmSession         string     `json:"mitm_session"`
	HostMethod          HostMethod `json:"host_method"`
	HasPassword         bool       `json:"has_password"`
	HasSpectatePassword bool       `json:"has_spectate_password"`
	Connectable         bool       `json:"connectable"`
	IsRetroArch         bool       `json:"is_retroarch"`
	CreatedAt           time.Time  `json:"created"`
	UpdatedAt           time.Time  `json:"updated" gorm:"index"`
}

Session is the database presentation of a netplay session.

func (*Session) CalculateContentHash

func (s *Session) CalculateContentHash()

CalculateContentHash creates a 32 byte SHAKE256 (SHA3) hash of the session content.

func (*Session) CalculateID

func (s *Session) CalculateID()

CalculateID creates a 32 byte SHAKE256 (SHA3) hash of the session for the db to use as PK.

func (*Session) PrintForRetroarch

func (s *Session) PrintForRetroarch() string

PrintForRetroarch prints out the session information in a format that retroarch is expecting.

Jump to

Keyboard shortcuts

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