strimertul_proxy

package module
v0.0.0-...-575bf80 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

README

Web proxy for strimertul

Self-hostable endpoint for allowing webpage interactions with strimertul clients. There is no replication/sync logic, it just forwards messages between clients and host.

To set a channel, add a channelname:hostpassword pair to the env var AUTH (comma-delimited for multiple channels).

To connect from strimertul, create an extension with this code:

// ==Extension==
// @name        Web proxy
// @version     1.0
// @author      Ash Keel
// @description Use a self-hosted proxy to integrate client pages with strimertul
// @apiversion  3.1.0
// ==/Extension==

const https = true;
const host = "your.ws.endpoint";
const channel = "channelname";
const password = "hostpassword";

var ws = new WebSocket(`${https ? "wss" : "ws"}://${host}/host/${channel}`);
ws.addEventListener("open", () => {
    console.log("Connected to proxy");
    ws.send(JSON.stringify({ password }));
});
ws.addEventListener("message", (event: MessageEvent) => {
    // event.data is your client's message
});

The entire project is licensed under AGPL-3.0-only (see LICENSE).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	Password string `json:"password"`
}

type Client

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

type HostStatus

type HostStatus struct {
	Connected bool `json:"connected"`
}

type Message

type Message struct {
	Type string `json:"type"`
	Data any    `json:"data"`
}

type Proxy

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

func NewProxy

func NewProxy(auth map[string]string) *Proxy

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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