···134 Replicators []string
135 WebsocketURL string
136 BehindHTTPSProxy bool
0137}
138139// ContentFilters represents the content filtering configuration
···195 fs.BoolVar(&cli.PrintChat, "print-chat", false, "print chat messages to stdout")
196 fs.StringVar(&cli.WHIPTest, "whip-test", "", "run a WHIP self-test with the given parameters")
197 fs.StringVar(&cli.RelayHost, "relay-host", "wss://bsky.network", "websocket url for relay firehose")
198- fs.Bool("insecure", false, "DEPRECATED, does nothing.")
199 fs.StringVar(&cli.Color, "color", "", "'true' to enable colorized logging, 'false' to disable")
200 fs.StringVar(&cli.BroadcasterHost, "broadcaster-host", "", "public host for the broadcaster group that this node is a part of (excluding https:// e.g. stream.place)")
201 fs.StringVar(&cli.XXDeprecatedPublicHost, "public-host", "", "deprecated, use broadcaster-host or server-host instead as appropriate")
202 fs.StringVar(&cli.ServerHost, "server-host", "", "public host for this particular physical streamplace node. defaults to broadcaster-host and only must be set for multi-node broadcasters")
203 fs.BoolVar(&cli.Thumbnail, "thumbnail", true, "enable thumbnail generation")
204 fs.BoolVar(&cli.SmearAudio, "smear-audio", false, "enable audio smearing to create 'perfect' segment timestamps")
205- fs.BoolVar(&cli.ExternalSigning, "external-signing", false, "enable external signing via exec (prevents potential memory leak)")
206 fs.StringVar(&cli.TracingEndpoint, "tracing-endpoint", "", "gRPC endpoint to send traces to")
207 fs.IntVar(&cli.RateLimitPerSecond, "rate-limit-per-second", 0, "rate limit for requests per second per ip")
208 fs.IntVar(&cli.RateLimitBurst, "rate-limit-burst", 0, "rate limit burst for requests per ip")
···221 fs.BoolVar(&cli.SQLLogging, "sql-logging", false, "enable sql logging")
222 fs.StringVar(&cli.SentryDSN, "sentry-dsn", "", "sentry dsn for error reporting")
223 fs.BoolVar(&cli.LivepeerDebug, "livepeer-debug", false, "log livepeer segments to $SP_DATA_DIR/livepeer-debug")
0224 cli.StringSliceFlag(fs, &cli.Tickets, "tickets", []string{}, "tickets to join the swarm with")
225 fs.StringVar(&cli.IrohTopic, "iroh-topic", "", "topic to use for the iroh swarm (must be 32 bytes in hex)")
226 fs.BoolVar(&cli.DisableIrohRelay, "disable-iroh-relay", false, "disable the iroh relay")
···229 cli.StringSliceFlag(fs, &cli.Replicators, "replicators", []string{ReplicatorWebsocket}, "list of replication protocols to use (http, iroh)")
230 fs.StringVar(&cli.WebsocketURL, "websocket-url", "", "override the websocket (ws:// or wss://) url to use for replication (normally not necessary, used for testing)")
231 fs.BoolVar(&cli.BehindHTTPSProxy, "behind-https-proxy", false, "set to true if this node is behind an https proxy and we should report https URLs even though the node isn't serving HTTPS")
000232233 lpFlags := flag.NewFlagSet("livepeer", flag.ContinueOnError)
234 _ = starter.NewLivepeerConfig(lpFlags)
···644func (cli *CLI) HasHTTPS() bool {
645 return cli.Secure || cli.BehindHTTPSProxy
646}
000000000000000000000000000
···134 Replicators []string
135 WebsocketURL string
136 BehindHTTPSProxy bool
137+ SegmentDebugDir string
138}
139140// ContentFilters represents the content filtering configuration
···196 fs.BoolVar(&cli.PrintChat, "print-chat", false, "print chat messages to stdout")
197 fs.StringVar(&cli.WHIPTest, "whip-test", "", "run a WHIP self-test with the given parameters")
198 fs.StringVar(&cli.RelayHost, "relay-host", "wss://bsky.network", "websocket url for relay firehose")
0199 fs.StringVar(&cli.Color, "color", "", "'true' to enable colorized logging, 'false' to disable")
200 fs.StringVar(&cli.BroadcasterHost, "broadcaster-host", "", "public host for the broadcaster group that this node is a part of (excluding https:// e.g. stream.place)")
201 fs.StringVar(&cli.XXDeprecatedPublicHost, "public-host", "", "deprecated, use broadcaster-host or server-host instead as appropriate")
202 fs.StringVar(&cli.ServerHost, "server-host", "", "public host for this particular physical streamplace node. defaults to broadcaster-host and only must be set for multi-node broadcasters")
203 fs.BoolVar(&cli.Thumbnail, "thumbnail", true, "enable thumbnail generation")
204 fs.BoolVar(&cli.SmearAudio, "smear-audio", false, "enable audio smearing to create 'perfect' segment timestamps")
0205 fs.StringVar(&cli.TracingEndpoint, "tracing-endpoint", "", "gRPC endpoint to send traces to")
206 fs.IntVar(&cli.RateLimitPerSecond, "rate-limit-per-second", 0, "rate limit for requests per second per ip")
207 fs.IntVar(&cli.RateLimitBurst, "rate-limit-burst", 0, "rate limit burst for requests per ip")
···220 fs.BoolVar(&cli.SQLLogging, "sql-logging", false, "enable sql logging")
221 fs.StringVar(&cli.SentryDSN, "sentry-dsn", "", "sentry dsn for error reporting")
222 fs.BoolVar(&cli.LivepeerDebug, "livepeer-debug", false, "log livepeer segments to $SP_DATA_DIR/livepeer-debug")
223+ fs.StringVar(&cli.SegmentDebugDir, "segment-debug-dir", "", "directory to log segment validation to")
224 cli.StringSliceFlag(fs, &cli.Tickets, "tickets", []string{}, "tickets to join the swarm with")
225 fs.StringVar(&cli.IrohTopic, "iroh-topic", "", "topic to use for the iroh swarm (must be 32 bytes in hex)")
226 fs.BoolVar(&cli.DisableIrohRelay, "disable-iroh-relay", false, "disable the iroh relay")
···229 cli.StringSliceFlag(fs, &cli.Replicators, "replicators", []string{ReplicatorWebsocket}, "list of replication protocols to use (http, iroh)")
230 fs.StringVar(&cli.WebsocketURL, "websocket-url", "", "override the websocket (ws:// or wss://) url to use for replication (normally not necessary, used for testing)")
231 fs.BoolVar(&cli.BehindHTTPSProxy, "behind-https-proxy", false, "set to true if this node is behind an https proxy and we should report https URLs even though the node isn't serving HTTPS")
232+233+ fs.Bool("external-signing", true, "DEPRECATED, does nothing.")
234+ fs.Bool("insecure", false, "DEPRECATED, does nothing.")
235236 lpFlags := flag.NewFlagSet("livepeer", flag.ContinueOnError)
237 _ = starter.NewLivepeerConfig(lpFlags)
···647func (cli *CLI) HasHTTPS() bool {
648 return cli.Secure || cli.BehindHTTPSProxy
649}
650+651+func (cli *CLI) DumpDebugSegment(ctx context.Context, name string, r io.Reader) {
652+ if cli.SegmentDebugDir == "" {
653+ return
654+ }
655+ go func() {
656+ err := os.MkdirAll(cli.SegmentDebugDir, 0755)
657+ if err != nil {
658+ log.Error(ctx, "failed to create debug directory", "error", err)
659+ return
660+ }
661+ now := aqtime.FromTime(time.Now())
662+ outFile := filepath.Join(cli.SegmentDebugDir, fmt.Sprintf("%s-%s", now.FileSafeString(), strings.ReplaceAll(name, ":", "-")))
663+ fd, err := os.Create(outFile)
664+ if err != nil {
665+ log.Error(ctx, "failed to create debug file", "error", err)
666+ return
667+ }
668+ defer fd.Close()
669+ _, err = io.Copy(fd, r)
670+ if err != nil {
671+ log.Error(ctx, "failed to copy debug file", "error", err)
672+ return
673+ }
674+ log.Log(ctx, "wrote debug file", "path", outFile)
675+ }()
676+}
-29
pkg/globalerror/globalerror.go
···1-package globalerror
2-3-import (
4- "fmt"
5- "path/filepath"
6- "runtime"
7- "sync"
8-)
9-10-var GlobalErrors []error
11-var mut sync.Mutex
12-13-func GlobalError(err error) {
14- if GlobalErrors == nil {
15- return
16- }
17- _, file, line, _ := runtime.Caller(1)
18-19- go func() {
20- mut.Lock()
21- defer mut.Unlock()
22- _, myfile, _, _ := runtime.Caller(0)
23- // This assumes that the root directory of streamplace is two levels above this folder.
24- // If that changes, please update this rootDir resolution.
25- rootDir := filepath.Join(filepath.Dir(myfile), "..", "..")
26- rel, _ := filepath.Rel(rootDir, file)
27- GlobalErrors = append(GlobalErrors, fmt.Errorf("%s:%d: %w", rel, line, err))
28- }()
29-}
···1uniffi::setup_scaffolding!();
23pub mod c2pa;
04pub mod node_addr;
5pub mod public_key;
067use std::sync::{LazyLock, Once};
8···10pub use db::*;
11#[cfg(test)]
12mod tests;
0001314/// Lazily initialized Tokio runtime for use in uniffi methods that need a runtime.
15static RUNTIME: LazyLock<tokio::runtime::Runtime> =
···1uniffi::setup_scaffolding!();
23pub mod c2pa;
4+pub mod error;
5pub mod node_addr;
6pub mod public_key;
7+pub mod streams;
89use std::sync::{LazyLock, Once};
10···12pub use db::*;
13#[cfg(test)]
14mod tests;
15+16+#[cfg(test)]
17+mod test_stream;
1819/// Lazily initialized Tokio runtime for use in uniffi methods that need a runtime.
20static RUNTIME: LazyLock<tokio::runtime::Runtime> =