psremote

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package psremote plays a PlayStation 4 or 5 on the home network through Matinee, with Remote Play: matinee-psremote (games/psremote, built on chiaki-ng) pairs with the console and receives its picture and sound, and this package turns them into the RTP packets the game stream sends on to players (see gamestream.Remote). The stream stays between the console, the server and the player, on the home network: it never goes through Sony's servers or anyone else's. Only pairing talks to Sony, once, to learn the player's PSN account ID (psn.go).

Index

Constants

View Source
const (
	KindVideo = mediabridge.KindVideo
	KindAudio = mediabridge.KindAudio
)

Packet kinds, as the game stream's (gamehost.KindVideo and KindAudio).

Variables

View Source
var ErrNoAnswer = errors.New("no PlayStation answered at that address")

ErrNoAnswer means no PlayStation answered at that address: it's off, unplugged, or the address is wrong.

Functions

func AccountID

func AccountID(s string) (string, error)

AccountID turns a PSN account ID as people paste it (base64, as Sony's pages and other Remote Play apps show it, or 16 hex digits) into hex.

func AccountIDFromUserID

func AccountIDFromUserID(id uint64) string

AccountIDFromUserID is the account ID of a PSN user id, the number Sony's sign-in gives: its 8 bytes, little-endian.

func CheckHost

func CheckHost(host string) error

CheckHost says whether host is an address on the home network, so the server never sends Remote Play anywhere else.

func CodeFromRedirect

func CodeFromRedirect(s string) (string, error)

CodeFromRedirect finds the one-time code in the address Sony's page ended on.

func SignIn

func SignIn(ctx context.Context, client *http.Client, code string) (string, error)

SignIn trades the one-time code for the account ID, in hex.

func SignInURL

func SignInURL() string

SignInURL is Sony's sign-in page.

Types

type Bridge

type Bridge struct {
	// Path is matinee-psremote's.
	Path string
}

Bridge runs matinee-psremote.

func (*Bridge) Available

func (b *Bridge) Available() bool

Available says whether this server has the bridge.

func (*Bridge) Pair

func (b *Bridge) Pair(ctx context.Context, host string, ps5 bool, account, pin string) (Console, error)

Pair pairs with the console at host, with the code it shows under Settings → System → Remote Play → Pair Device (PS5), or Settings → Remote Play Connection Settings → Add Device (PS4). account is the PSN account ID, in hex (see AccountID).

func (*Bridge) Play

func (b *Bridge) Play(ctx context.Context, c Console, account string, height, fps int, log *slog.Logger) (*Stream, error)

Play connects to the console and waits until its stream starts. The console must be on (see WakeAndWait). height is 1080, 720 or 540 (a PS4 that isn't a Pro sends 720 at most); fps 60 or 30.

func (*Bridge) Status

func (b *Bridge) Status(ctx context.Context, host string) (Status, error)

Status asks the console at host whether it's on.

func (*Bridge) Wake

func (b *Bridge) Wake(ctx context.Context, c Console) error

Wake wakes the console from rest mode.

func (*Bridge) WakeAndWait

func (b *Bridge) WakeAndWait(ctx context.Context, c Console) error

WakeAndWait wakes the console if it's resting and waits until it's on, which takes a PS5 about 20 seconds.

type Console

type Console struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// Host is its address on the home network.
	Host string `json:"host"`
	PS5  bool   `json:"ps5"`
	MAC  string `json:"mac,omitempty"`
	// What pairing gave, which Remote Play needs: 32 hex digits each.
	RegistKey string `json:"registKey"`
	RPKey     string `json:"rpKey"`
	Target    int    `json:"target,omitempty"`
}

Console is a paired PlayStation.

type Status

type Status struct {
	// State is "ready" (on) or "standby" (in rest mode).
	State string `json:"state"`
	Name  string `json:"name"`
	PS5   bool   `json:"ps5"`
	// App is the game or app it's running, when it's on.
	App string `json:"app,omitempty"`
}

Status is what a console says about itself.

type Stream

type Stream struct {
	*mediabridge.Stream
	// contains filtered or unexported fields
}

Stream is a console being played: its picture and sound as RTP packets (see mediabridge.Stream), and the player's controller back to it.

func (*Stream) Input

func (s *Stream) Input(b []byte)

Input takes the player's input messages (see gamestream.Session.input): the first controller's buttons and sticks.

Jump to

Keyboard shortcuts

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