Live video on the AT Protocol

config: fix livepeer stuff

+33 -63
+3 -2
go.mod
··· 8 8 9 9 replace github.com/AxisCommunications/go-dpop => github.com/streamplace/go-dpop v0.0.0-20250510031900-c897158a8ad4 10 10 11 + replace github.com/livepeer/go-livepeer => ../go-livepeer 12 + 11 13 tool github.com/bluesky-social/indigo/cmd/lexgen 12 14 13 15 require ( ··· 48 50 github.com/multiformats/go-multihash v0.2.3 49 51 github.com/orandin/slog-gorm v1.4.0 50 52 github.com/patrickmn/go-cache v2.1.0+incompatible 51 - github.com/peterbourgon/ff/v3 v3.4.0 52 53 github.com/pion/interceptor v0.1.37 53 54 github.com/pion/rtcp v1.2.16 54 55 github.com/pion/webrtc/v4 v4.0.11 ··· 64 65 github.com/streamplace/oatproxy v0.0.0-20260130124113-420429019d3b 65 66 github.com/stretchr/testify v1.11.1 66 67 github.com/tdewolff/canvas v0.0.0-20250728095813-50d4cb1eee71 68 + github.com/urfave/cli/v3 v3.6.2 67 69 github.com/whyrusleeping/cbor-gen v0.3.1 68 70 github.com/whyrusleeping/go-did v0.0.0-20230824162731-404d1707d5d6 69 71 gitlab.com/gitlab-org/release-cli v0.18.0 ··· 475 477 github.com/ultraware/funlen v0.2.0 // indirect 476 478 github.com/ultraware/whitespace v0.2.0 // indirect 477 479 github.com/urfave/cli/v2 v2.27.7 // indirect 478 - github.com/urfave/cli/v3 v3.6.2 // indirect 479 480 github.com/uudashr/gocognit v1.2.0 // indirect 480 481 github.com/uudashr/iface v1.3.1 // indirect 481 482 github.com/valyala/bytebufferpool v1.0.0 // indirect
-6
go.sum
··· 923 923 github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= 924 924 github.com/libp2p/go-netroute v0.2.2 h1:Dejd8cQ47Qx2kRABg6lPwknU7+nBnFRpko45/fFPuZ8= 925 925 github.com/libp2p/go-netroute v0.2.2/go.mod h1:Rntq6jUAH0l9Gg17w5bFGhcC9a+vk4KNXs6s7IljKYE= 926 - github.com/livepeer/go-livepeer v0.8.7-0.20250811105915-31d2e1f89f81 h1:ObaUiy1Jl5n7yTG96sVnU+SDqntYRZi45qdebl6RoXk= 927 - github.com/livepeer/go-livepeer v0.8.7-0.20250811105915-31d2e1f89f81/go.mod h1:3sDsXYtDJLKcwCE8TmYjjj6yz2mPQXBHa+24u2PfWh8= 928 926 github.com/livepeer/go-tools v0.3.6-0.20240130205227-92479de8531b h1:VQcnrqtCA2UROp7q8ljkh2XA/u0KRgVv0S1xoUvOweE= 929 927 github.com/livepeer/go-tools v0.3.6-0.20240130205227-92479de8531b/go.mod h1:hwJ5DKhl+pTanFWl+EUpw1H7ukPO/H+MFpgA7jjshzw= 930 928 github.com/livepeer/joy4 v0.1.2-0.20191121080656-b2fea45cbded h1:ZQlvR5RB4nfT+cOQee+WqmaDOgGtP2oDMhcVvR4L0yA= ··· 1080 1078 github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= 1081 1079 github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 h1:1/WtZae0yGtPq+TI6+Tv1WTxkukpXeMlviSxvL7SRgk= 1082 1080 github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9/go.mod h1:x3N5drFsm2uilKKuuYo6LdyD8vZAW55sH/9w+pbo1sw= 1083 - github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc= 1084 - github.com/peterbourgon/ff/v3 v3.4.0/go.mod h1:zjJVUhx+twciwfDl0zBcFzl4dW8axCRyXE/eKY9RztQ= 1085 1081 github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= 1086 1082 github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= 1087 1083 github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= ··· 1317 1313 github.com/streamplace/atproto-oauth-golang v0.0.0-20250619231223-a9c04fb888ac/go.mod h1:9LlKkqciiO5lRfbX0n4Wn5KNY9nvFb4R3by8FdW2TWc= 1318 1314 github.com/streamplace/go-dpop v0.0.0-20250510031900-c897158a8ad4 h1:L1fS4HJSaAyNnkwfuZubgfeZy8rkWmA0cMtH5Z0HqNc= 1319 1315 github.com/streamplace/go-dpop v0.0.0-20250510031900-c897158a8ad4/go.mod h1:bGUXY9Wd4mnd+XUrOYZr358J2f6z9QO/dLhL1SsiD+0= 1320 - github.com/streamplace/oatproxy v0.0.0-20260112011721-d74b4913c93f h1:hhbQ8CtcAZVlLit/r7b9QDK7qEgOth4hgE13xV6ViBI= 1321 - github.com/streamplace/oatproxy v0.0.0-20260112011721-d74b4913c93f/go.mod h1:pXi24hA7xBHj8eEywX6wGqJOR9FaEYlGwQ/72rN6okw= 1322 1316 github.com/streamplace/oatproxy v0.0.0-20260130124113-420429019d3b h1:BB/R1egvkEqZhGeKL3tqAlTn0mkoOaaMY6r6s18XJYA= 1323 1317 github.com/streamplace/oatproxy v0.0.0-20260130124113-420429019d3b/go.mod h1:pXi24hA7xBHj8eEywX6wGqJOR9FaEYlGwQ/72rN6okw= 1324 1318 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+2 -31
pkg/cmd/go_livepeer.go
··· 3 3 import ( 4 4 "context" 5 5 "flag" 6 - "strings" 7 6 8 - "github.com/golang/glog" 9 7 "github.com/livepeer/go-livepeer/cmd/livepeer/starter" 10 8 "stream.place/streamplace/pkg/config" 11 9 ) 12 10 13 11 func GoLivepeer(ctx context.Context, fs *flag.FlagSet) error { 14 - lpfs := flag.NewFlagSet("livepeer", flag.ExitOnError) 15 - cfg := starter.NewLivepeerConfig(lpfs) 16 - fs.VisitAll(func(f *flag.Flag) { 17 - if !strings.HasPrefix(f.Name, "livepeer.") { 18 - return 19 - } 20 - name := strings.TrimPrefix(f.Name, "livepeer.") 21 - adapted := config.LivepeerFlags.SnakeToCamel[name] 22 - 23 - if adapted == "" { 24 - panic("unknown livepeer flag: " + name) 25 - } 26 - err := lpfs.Set(adapted, f.Value.String()) 27 - if err != nil { 28 - panic(err) 29 - } 30 - }) 31 - 32 12 err := flag.Set("logtostderr", "true") 33 13 if err != nil { 34 14 return err ··· 39 19 return err 40 20 } 41 21 42 - // Config file 43 - // err = ff.Parse(fs, args, 44 - // ff.WithConfigFileFlag("config"), 45 - // ff.WithEnvVarPrefix("SP_LIVEPEER"), 46 - // ) 47 - if err != nil { 48 - glog.Exit("Error parsing config: ", err) 49 - } 50 - 51 - cfg = starter.UpdateNilsForUnsetFlags(cfg) 22 + config.LivepeerConfig = starter.UpdateNilsForUnsetFlags(config.LivepeerConfig) 52 23 53 - starter.StartLivepeer(ctx, cfg) 24 + starter.StartLivepeer(ctx, config.LivepeerConfig) 54 25 55 26 return nil 56 27 }
+9 -24
pkg/cmd/streamplace.go
··· 72 72 makeMigrateCommand(build), 73 73 } 74 74 // Add the verbosity flag 75 - app.Flags = append(app.Flags, &urfavecli.StringFlag{ 76 - Name: "v", 77 - Usage: "log verbosity level", 78 - Value: "3", 79 - }) 75 + // app.Flags = append(app.Flags, &urfavecli.StringFlag{ 76 + // Name: "v", 77 + // Usage: "log verbosity level", 78 + // Value: "3", 79 + // }) 80 80 app.Before = func(ctx context.Context, cmd *urfavecli.Command) (context.Context, error) { 81 81 // Run self-test before starting 82 82 selfTest := cmd.Name == "self-test" ··· 406 406 return err 407 407 } 408 408 group.Go(func() error { 409 - lpfs := flag.NewFlagSet("livepeer", flag.ExitOnError) 410 - _ = starter.NewLivepeerConfig(lpfs) 411 - // Parse livepeer flags from mainCmd 412 - err := lpfs.Parse([]string{}) 413 - if err != nil { 414 - return err 415 - } 416 - err = GoLivepeer(ctx, lpfs) 409 + err = GoLivepeer(ctx, config.LivepeerFlagSet) 417 410 if err != nil { 418 411 return err 419 412 } ··· 647 640 648 641 func makeLivepeerCommand(build *config.BuildFlags) *urfavecli.Command { 649 642 return &urfavecli.Command{ 650 - Name: "livepeer", 651 - Usage: "run livepeer gateway", 652 - SkipFlagParsing: true, 643 + Name: "livepeer", 644 + Usage: "run livepeer gateway", 653 645 Action: func(ctx context.Context, cmd *urfavecli.Command) error { 654 - args := cmd.Args().Slice() 655 - lpfs := flag.NewFlagSet("livepeer", flag.ExitOnError) 656 - _ = starter.NewLivepeerConfig(lpfs) 657 - err := lpfs.Parse(args) 658 - if err != nil { 659 - return err 660 - } 661 - return GoLivepeer(ctx, lpfs) 646 + return GoLivepeer(ctx, config.LivepeerFlagSet) 662 647 }, 663 648 } 664 649 }
+19
pkg/config/config.go
··· 7 7 "encoding/json" 8 8 "encoding/pem" 9 9 "errors" 10 + "flag" 10 11 "fmt" 11 12 "io" 12 13 "net" ··· 21 22 "math/rand/v2" 22 23 23 24 "github.com/lestrrat-go/jwx/v2/jwk" 25 + "github.com/livepeer/go-livepeer/cmd/livepeer/starter" 24 26 "github.com/lmittmann/tint" 25 27 slogGorm "github.com/orandin/slog-gorm" 26 28 urfavecli "github.com/urfave/cli/v3" ··· 158 160 ReplicatorWebsocket string = "websocket" 159 161 ReplicatorIroh string = "iroh" 160 162 ) 163 + 164 + var LivepeerFlagSet *flag.FlagSet 165 + var LivepeerConfig starter.LivepeerConfig 161 166 162 167 func (cli *CLI) NewCommand(name string) *urfavecli.Command { 163 168 cmd := &urfavecli.Command{ ··· 845 850 Sources: urfavecli.EnvVars("SP_MIST_HTTP_PORT"), 846 851 }) 847 852 } 853 + 854 + LivepeerFlagSet = flag.NewFlagSet("livepeer", flag.ContinueOnError) 855 + LivepeerConfig = starter.NewLivepeerConfig(LivepeerFlagSet) 856 + LivepeerFlagSet.VisitAll(func(f *flag.Flag) { 857 + adapted := LivepeerFlags.CamelToSnake[f.Name] 858 + cmd.Flags = append(cmd.Flags, &urfavecli.StringFlag{ 859 + Name: fmt.Sprintf("livepeer.%s", adapted), 860 + Usage: f.Usage, 861 + Sources: urfavecli.EnvVars(fmt.Sprintf("SP_LIVEPEER_%s", adapted)), 862 + Action: func(ctx context.Context, cmd *urfavecli.Command, s string) error { 863 + return LivepeerFlagSet.Set(f.Name, s) 864 + }, 865 + }) 866 + }) 848 867 849 868 return cmd 850 869 }