ipc

package
v0.8.21 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 11 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 ipc is the link between the native messaging host and the app.

The app listens on a random 127.0.0.1 port and writes {port, token} to %APPDATA%\Velo\endpoint.json. Every request must carry the token, so web pages that probe localhost can't add downloads.

Index

Constants

View Source
const TokenHeader = "X-Velo-Token"

Variables

This section is empty.

Functions

func Call

func Call(cmd, id string, body []byte) ([]byte, error)

Call sends a command (add, list, pause, resume, show) to the running app and returns the raw JSON response.

func Dir

func Dir() string

Dir is Velo's data folder: %APPDATA%\Velo, the "data" folder of a portable copy, or $VELO_HOME if set (tests).

func NewToken

func NewToken() string

func Portable

func Portable() (string, bool)

Portable reports whether this is a portable copy (a file named "portable" next to the program) and returns the program's folder.

func RemoveEndpoint

func RemoveEndpoint()

func WriteEndpoint

func WriteEndpoint(e Endpoint) error

Types

type Endpoint

type Endpoint struct {
	Port  int    `json:"port"`
	Token string `json:"token"`
	PID   int    `json:"pid"`
}

func ReadEndpoint

func ReadEndpoint() (Endpoint, error)

type Job

type Job struct {
	Type      string `json:"type"`
	URL       string `json:"url"`
	Referrer  string `json:"referrer"`
	Filename  string `json:"filename"`
	Cookies   string `json:"cookies"`
	UserAgent string `json:"userAgent"`
	Kind      string `json:"kind"`   // "" = file, "hls" = video stream
	Format    string `json:"format"` // "", "1080p", "720p", "480p", "audio"
	Title     string `json:"title"`  // page title, used to name videos
	Source    string `json:"source"` // "capture" = a download the browser started
	Size      int64  `json:"size"`   // size the browser reported, if known
}

type Reply

type Reply struct {
	OK    bool   `json:"ok"`
	ID    int    `json:"id,omitempty"`
	Error string `json:"error,omitempty"`
	Ext   string `json:"ext,omitempty"` // version of the extension installed next to Velo
}

Jump to

Keyboard shortcuts

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