df -> v0.3.0

This commit is contained in:
Michael Quigley
2025-09-13 23:30:21 -04:00
parent d05ad7a7cd
commit 63144078a1
41 changed files with 146 additions and 141 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
package canary
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/metrics"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -15,13 +15,13 @@ type Config struct {
}
func LoadConfig(path string) (*Config, error) {
cfg, err := df.NewFromYAML[Config](path)
cfg, err := dd.NewFromYAML[Config](path)
if err != nil {
return nil, err
}
if cfg.V != ConfigVersion {
return nil, errors.Errorf("expecting canary configuration version '%v', got '%v'", ConfigVersion, cfg.V)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
return cfg, nil
}
+2 -2
View File
@@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/publicProxy"
"github.com/openziti/zrok/tui"
"github.com/sirupsen/logrus"
@@ -42,7 +42,7 @@ func (cmd *accessPublicCommand) run(_ *cobra.Command, args []string) {
panic(err)
}
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
frontend, err := publicProxy.NewHTTP(cfg)
if err != nil {
if !panicInstead {
+2 -2
View File
@@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/publicProxy"
"github.com/openziti/zrok/tui"
"github.com/sirupsen/logrus"
@@ -34,5 +34,5 @@ func (cmd *accessPublicValidateCommand) run(_ *cobra.Command, args []string) {
if err := cfg.Load(args[0]); err != nil {
tui.Error(fmt.Sprintf("unable to load configuration '%v'", args[0]), err)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
}
+2 -2
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller"
"github.com/openziti/zrok/controller/config"
"github.com/sirupsen/logrus"
@@ -35,7 +35,7 @@ func (cmd *adminBootstrap) run(_ *cobra.Command, args []string) {
if err != nil {
panic(err)
}
logrus.Info(df.MustInspect(inCfg))
logrus.Info(dd.MustInspect(inCfg))
if err := controller.Bootstrap(cmd.skipFrontend, inCfg); err != nil {
panic(err)
}
+2 -2
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller"
"github.com/openziti/zrok/controller/config"
"github.com/sirupsen/logrus"
@@ -32,7 +32,7 @@ func (gc *adminGcCommand) run(_ *cobra.Command, args []string) {
if err != nil {
panic(err)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
if err := controller.GC(cfg); err != nil {
panic(err)
}
+2 -2
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/config"
"github.com/openziti/zrok/controller/store"
"github.com/sirupsen/logrus"
@@ -36,7 +36,7 @@ func (cmd *adminMigrate) run(_ *cobra.Command, args []string) {
panic(err)
}
logrus.Info(df.MustInspect(inCfg))
logrus.Info(dd.MustInspect(inCfg))
// disable auto-migration, we'll control it manually
inCfg.Store.DisableAutoMigration = true
+2 -2
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller"
"github.com/openziti/zrok/controller/config"
"github.com/sirupsen/logrus"
@@ -32,7 +32,7 @@ func (cmd *adminUnbootstrap) run(_ *cobra.Command, args []string) {
if err != nil {
panic(err)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
if err := controller.Unbootstrap(cfg); err != nil {
panic(err)
}
+2 -2
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller"
"github.com/openziti/zrok/controller/config"
"github.com/sirupsen/logrus"
@@ -42,7 +42,7 @@ func (cmd *controllerCommand) run(_ *cobra.Command, args []string) {
if err != nil {
panic(err)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
if err := controller.Run(cfg); err != nil {
panic(err)
}
+2 -2
View File
@@ -6,7 +6,7 @@ import (
"syscall"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/config"
"github.com/openziti/zrok/controller/metrics"
"github.com/sirupsen/logrus"
@@ -37,7 +37,7 @@ func (cmd *bridgeCommand) run(_ *cobra.Command, args []string) {
if err != nil {
panic(err)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
bridge, err := metrics.NewBridge(cfg.Bridge)
if err != nil {
+2 -2
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/config"
"github.com/openziti/zrok/tui"
"github.com/sirupsen/logrus"
@@ -32,5 +32,5 @@ func (cmd *controllerValidateCommand) run(_ *cobra.Command, args []string) {
if err != nil {
tui.Error("controller config validation failed", err)
}
logrus.Info(df.MustInspect(cfg))
logrus.Info(dd.MustInspect(cfg))
}
+1 -1
View File
@@ -10,7 +10,7 @@ import (
type Config struct {
ApiEndpoint string
Username string
Password string `df:"+secret"`
Password string `dd:"+secret"`
}
type Client struct {
+3 -3
View File
@@ -6,7 +6,7 @@ import (
"strconv"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/agentController"
"github.com/openziti/zrok/controller/dynamicProxyController"
"github.com/openziti/zrok/controller/emailUi"
@@ -41,7 +41,7 @@ type Config struct {
}
type AdminConfig struct {
Secrets []string `df:"+secret"`
Secrets []string `dd:"+secret"`
TouLink string
NewAccountLink string
ProfileEndpoint string
@@ -125,7 +125,7 @@ func DefaultConfig() *Config {
func LoadConfig(path string) (*Config, error) {
cfg := DefaultConfig()
if err := df.MergeFromYAML(cfg, path, env.GetDfOptions()); err != nil {
if err := dd.MergeFromYAML(cfg, path, env.GetDdOptions()); err != nil {
return nil, errors.Wrapf(err, "error loading controller config '%v'", path)
}
if !envVersionOk() && cfg.V != ConfigVersion {
@@ -5,15 +5,15 @@ import (
"encoding/json"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/pkg/errors"
amqp "github.com/rabbitmq/amqp091-go"
"github.com/sirupsen/logrus"
)
type AmqpPublisherConfig struct {
Url string `df:"+required"`
ExchangeName string `df:"+required"`
Url string `dd:"+required"`
ExchangeName string `dd:"+required"`
}
type AmqpPublisher struct {
@@ -74,7 +74,7 @@ func (p *AmqpPublisher) Publish(ctx context.Context, frontendToken string, m Map
}
}
data, err := df.Unbind(m)
data, err := dd.Unbind(m)
if err != nil {
return errors.Wrap(err, "failed to serialize mapping")
}
+3 -3
View File
@@ -1,7 +1,7 @@
package dynamicProxyController
type Config struct {
IdentityPath string `df:"+required"`
ServiceName string `df:"+required"`
AmqpPublisher *AmqpPublisherConfig `df:"+required"`
IdentityPath string `dd:"+required"`
ServiceName string `dd:"+required"`
AmqpPublisher *AmqpPublisherConfig `dd:"+required"`
}
+1 -1
View File
@@ -4,6 +4,6 @@ type Config struct {
Host string
Port int
Username string
Password string `df:"+secret"`
Password string `dd:"+secret"`
From string
}
+7 -7
View File
@@ -1,16 +1,16 @@
package env
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/metrics"
)
var dfOpts *df.Options
var ddOpts *dd.Options
func GetDfOptions() *df.Options {
if dfOpts == nil {
dfOpts = &df.Options{
DynamicBinders: map[string]func(map[string]any) (df.Dynamic, error){
func GetDdOptions() *dd.Options {
if ddOpts == nil {
ddOpts = &dd.Options{
DynamicBinders: map[string]func(map[string]any) (dd.Dynamic, error){
metrics.AmqpSinkType: metrics.LoadAmqpSink,
metrics.AmqpSourceType: metrics.LoadAmqpSource,
metrics.FileSourceType: metrics.LoadFileSource,
@@ -18,5 +18,5 @@ func GetDfOptions() *df.Options {
},
}
}
return dfOpts
return ddOpts
}
+4 -4
View File
@@ -4,7 +4,7 @@ import (
"context"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/pkg/errors"
amqp "github.com/rabbitmq/amqp091-go"
"github.com/sirupsen/logrus"
@@ -13,12 +13,12 @@ import (
const AmqpSinkType = "amqpSink"
type AmqpSinkConfig struct {
Url string `df:"+secret"`
Url string `dd:"+secret"`
QueueName string
}
func LoadAmqpSink(v map[string]any) (df.Dynamic, error) {
cfg, err := df.New[AmqpSinkConfig](v)
func LoadAmqpSink(v map[string]any) (dd.Dynamic, error) {
cfg, err := dd.New[AmqpSinkConfig](v)
if err != nil {
return nil, err
}
+4 -4
View File
@@ -3,7 +3,7 @@ package metrics
import (
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/pkg/errors"
amqp "github.com/rabbitmq/amqp091-go"
"github.com/sirupsen/logrus"
@@ -12,12 +12,12 @@ import (
const AmqpSourceType = "amqpSource"
type AmqpSourceConfig struct {
Url string `df:"+secret"`
Url string `dd:"+secret"`
QueueName string
}
func LoadAmqpSource(v map[string]any) (df.Dynamic, error) {
cfg, err := df.New[AmqpSourceConfig](v)
func LoadAmqpSource(v map[string]any) (dd.Dynamic, error) {
cfg, err := dd.New[AmqpSourceConfig](v)
if err != nil {
return nil, err
}
+3 -3
View File
@@ -1,14 +1,14 @@
package metrics
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
type BridgeConfig struct {
Source df.Dynamic
Sink df.Dynamic
Source dd.Dynamic
Sink dd.Dynamic
}
type Bridge struct {
+5 -3
View File
@@ -1,6 +1,8 @@
package metrics
import "github.com/michaelquigley/df"
import (
"github.com/michaelquigley/df/dd"
)
type Config struct {
Influx *InfluxConfig
@@ -8,12 +10,12 @@ type Config struct {
}
type AgentConfig struct {
Source df.Dynamic
Source dd.Dynamic
}
type InfluxConfig struct {
Url string
Bucket string
Org string
Token string `df:"+secret"`
Token string `dd:"+secret"`
}
+3 -3
View File
@@ -4,7 +4,7 @@ import (
"encoding/binary"
"os"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/nxadm/tail"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -17,8 +17,8 @@ type FileSourceConfig struct {
PointerPath string
}
func LoadFileSource(v map[string]any) (df.Dynamic, error) {
cfg, err := df.New[FileSourceConfig](v)
func LoadFileSource(v map[string]any) (dd.Dynamic, error) {
cfg, err := dd.New[FileSourceConfig](v)
if err != nil {
return nil, err
}
+4 -4
View File
@@ -10,7 +10,7 @@ import (
"time"
"github.com/gorilla/websocket"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/channel/v4"
"github.com/openziti/channel/v4/websockets"
"github.com/openziti/edge-api/rest_util"
@@ -28,11 +28,11 @@ type WebsocketSourceConfig struct {
WebsocketEndpoint string // wss://127.0.0.1:1280/fabric/v1/ws-api
ApiEndpoint string // https://127.0.0.1:1280
Username string
Password string `df:"+secret"`
Password string `dd:"+secret"`
}
func LoadWebsocketSource(v map[string]any) (df.Dynamic, error) {
cfg, err := df.New[WebsocketSourceConfig](v)
func LoadWebsocketSource(v map[string]any) (dd.Dynamic, error) {
cfg, err := dd.New[WebsocketSourceConfig](v)
if err != nil {
return nil, err
}
+1 -1
View File
@@ -23,7 +23,7 @@ type Model struct {
}
type Config struct {
Path string `df:"+secret"`
Path string `dd:"+secret"`
Type string
EnableLocking bool
DisableAutoMigration bool
+1 -1
View File
@@ -10,7 +10,7 @@ import (
type Config struct {
ApiEndpoint string
Username string
Password string `df:"+secret"`
Password string `dd:"+secret"`
}
func Client(cfg *Config) (*rest_management_api_client.ZitiEdgeManagement, error) {
+7 -6
View File
@@ -6,7 +6,8 @@ import (
"time"
"github.com/google/uuid"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/da"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/controller/dynamicProxyController"
"github.com/pkg/errors"
amqp "github.com/rabbitmq/amqp091-go"
@@ -14,8 +15,8 @@ import (
)
type amqpSubscriberConfig struct {
Url string `df:"+required"`
ExchangeName string `df:"+required"`
Url string `dd:"+required"`
ExchangeName string `dd:"+required"`
QueueDepth int
}
@@ -31,12 +32,12 @@ type amqpSubscriber struct {
updates chan *dynamicProxyController.Mapping
}
func buildAmqpSubscriber(app *df.Application[*config]) error {
func buildAmqpSubscriber(app *da.Application[*config]) error {
subscriber, err := newAmqpSubscriber(app.Cfg)
if err != nil {
return err
}
df.Set(app.C, subscriber)
da.Set(app.C, subscriber)
return nil
}
@@ -206,7 +207,7 @@ func (s *amqpSubscriber) handleMessage(delivery amqp.Delivery) error {
if err := json.Unmarshal(delivery.Body, &data); err != nil {
return errors.Wrap(err, "failed to unmarshal mapping data")
}
update, err := df.New[dynamicProxyController.Mapping](data)
update, err := dd.New[dynamicProxyController.Mapping](data)
if err != nil {
return err
}
+2 -2
View File
@@ -8,7 +8,7 @@ import (
"github.com/gobwas/glob"
"github.com/golang-jwt/jwt/v5"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -161,7 +161,7 @@ func configureOauth(cfg *config, tls bool) error {
// configure providers (they will register themselves with the router)
for _, v := range cfg.Oauth.Providers {
if prvCfg, ok := v.(df.Dynamic); ok {
if prvCfg, ok := v.(dd.Dynamic); ok {
switch prvCfg.Type() {
case "github":
githubCfg, ok := prvCfg.(*githubConfig)
+7 -6
View File
@@ -7,17 +7,18 @@ import (
"time"
"github.com/gorilla/mux"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/da"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
var oauthBinders map[string]func(map[string]any) (df.Dynamic, error)
var oauthBinders map[string]func(map[string]any) (dd.Dynamic, error)
func registerOauthBinder(typ string, binder func(map[string]any) (df.Dynamic, error)) {
func registerOauthBinder(typ string, binder func(map[string]any) (dd.Dynamic, error)) {
if oauthBinders == nil {
oauthBinders = make(map[string]func(map[string]any) (df.Dynamic, error))
oauthBinders = make(map[string]func(map[string]any) (dd.Dynamic, error))
}
oauthBinders[typ] = binder
}
@@ -122,7 +123,7 @@ func (r *oauthRouter) Stop() error {
}
// buildOAuthRouter creates and registers the OAuth router as a df component
func buildOAuthRouter(app *df.Application[*config]) error {
func buildOAuthRouter(app *da.Application[*config]) error {
if app.Cfg.Oauth == nil {
logrus.Info("no oauth configuration; skipping oauth router")
return nil
@@ -132,6 +133,6 @@ func buildOAuthRouter(app *df.Application[*config]) error {
globalOAuthRouter = newOAuthRouter(app.Cfg.Oauth)
// register with df container for lifecycle management
df.Set(app.C, globalOAuthRouter)
da.Set(app.C, globalOAuthRouter)
return nil
}
+9 -9
View File
@@ -3,21 +3,21 @@ package dynamicProxy
import (
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints"
)
type config struct {
V int `df:"+match=1"`
FrontendToken string `df:"+required"`
V int `dd:"+match=1"`
FrontendToken string `dd:"+required"`
Identity string
BindAddress string
TemplatePath string
MappingRefreshInterval time.Duration
Interstitial *interstitialConfig
Oauth *oauthConfig
AmqpSubscriber *amqpSubscriberConfig `df:"+required"`
Controller *controllerClientConfig `df:"+required"`
AmqpSubscriber *amqpSubscriberConfig `dd:"+required"`
Controller *controllerClientConfig `dd:"+required"`
Tls *endpoints.TlsConfig
}
@@ -34,15 +34,15 @@ type oauthConfig struct {
CookieDomain string
SessionLifetime time.Duration
IntermediateLifetime time.Duration
SigningKey string `df:"+secret"`
EncryptionKey string `df:"+secret"`
Providers []df.Dynamic
SigningKey string `dd:"+secret"`
EncryptionKey string `dd:"+secret"`
Providers []dd.Dynamic
}
type oauthProviderConfig struct {
Name string
ClientId string
ClientSecret string `df:"+secret"`
ClientSecret string `dd:"+secret"`
}
func defaults() *config {
+5 -5
View File
@@ -5,7 +5,7 @@ import (
"net"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/da"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/zrok/controller/dynamicProxyController"
"github.com/pkg/errors"
@@ -16,8 +16,8 @@ import (
)
type controllerClientConfig struct {
IdentityPath string `df:"+required"`
ServiceName string `df:"+required"`
IdentityPath string `dd:"+required"`
ServiceName string `dd:"+required"`
Timeout time.Duration
}
@@ -29,12 +29,12 @@ type controllerClient struct {
cancel context.CancelFunc
}
func buildControllerClient(app *df.Application[*config]) error {
func buildControllerClient(app *da.Application[*config]) error {
client, err := newControllerClient(app.Cfg.Controller)
if err != nil {
return err
}
df.Set(app.C, client)
da.Set(app.C, client)
return nil
}
+5 -5
View File
@@ -10,7 +10,7 @@ import (
"strings"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/da"
"github.com/openziti/sdk-golang/ziti"
"github.com/openziti/zrok/endpoints"
"github.com/openziti/zrok/endpoints/proxyUi"
@@ -31,12 +31,12 @@ type httpListener struct {
server *http.Server
}
func buildHttpListener(app *df.Application[*config]) error {
func buildHttpListener(app *da.Application[*config]) error {
hl, err := newHttpListener(app.Cfg)
if err != nil {
return err
}
df.Set(app.C, hl)
da.Set(app.C, hl)
return nil
}
@@ -272,9 +272,9 @@ func (l *httpListener) initializeHandler() error {
return nil
}
func (l *httpListener) Link(c *df.Container) error {
func (l *httpListener) Link(c *da.Container) error {
var found bool
l.mappings, found = df.Get[*mappings](c)
l.mappings, found = da.Get[*mappings](c)
if !found {
return errors.New("mapping not found")
}
+11 -10
View File
@@ -1,26 +1,27 @@
package dynamicProxy
import (
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/da"
"github.com/michaelquigley/df/dd"
"github.com/sirupsen/logrus"
)
type Service struct {
app *df.Application[*config]
app *da.Application[*config]
}
func NewService(cfgPath string) (*Service, error) {
svc := &Service{app: df.NewApplication[*config](defaults())}
df.WithFactoryFunc(svc.app, buildAmqpSubscriber)
df.WithFactoryFunc(svc.app, buildControllerClient)
df.WithFactoryFunc(svc.app, buildMappings)
df.WithFactoryFunc(svc.app, buildOAuthRouter)
df.WithFactoryFunc(svc.app, buildHttpListener)
opts := &df.Options{DynamicBinders: oauthBinders}
svc := &Service{app: da.NewApplication[*config](defaults())}
da.WithFactoryFunc(svc.app, buildAmqpSubscriber)
da.WithFactoryFunc(svc.app, buildControllerClient)
da.WithFactoryFunc(svc.app, buildMappings)
da.WithFactoryFunc(svc.app, buildOAuthRouter)
da.WithFactoryFunc(svc.app, buildHttpListener)
opts := &dd.Options{DynamicBinders: oauthBinders}
if err := svc.app.InitializeWithOptions(opts, cfgPath); err != nil {
return nil, err
}
logrus.Info(df.MustInspect(svc.app.Cfg))
logrus.Info(dd.MustInspect(svc.app.Cfg))
return svc, nil
}
+6 -6
View File
@@ -5,7 +5,7 @@ import (
"sync"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/da"
"github.com/openziti/zrok/controller/dynamicProxyController"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -21,10 +21,10 @@ type mappings struct {
nameMap map[string]*dynamicProxyController.FrontendMapping
}
func buildMappings(app *df.Application[*config]) error {
func buildMappings(app *da.Application[*config]) error {
mappings := newMappings()
mappings.cfg = app.Cfg
df.Set(app.C, mappings)
da.Set(app.C, mappings)
return nil
}
@@ -42,14 +42,14 @@ func (m *mappings) getMapping(name string) (*dynamicProxyController.FrontendMapp
return mapping, exists
}
func (m *mappings) Link(c *df.Container) error {
func (m *mappings) Link(c *da.Container) error {
var found bool
m.amqp, found = df.Get[*amqpSubscriber](c)
m.amqp, found = da.Get[*amqpSubscriber](c)
if !found {
return errors.New("no amqp subscriber found")
}
m.ctrl, found = df.Get[*controllerClient](c)
m.ctrl, found = da.Get[*controllerClient](c)
if !found {
return errors.New("no controller client found")
}
+3 -3
View File
@@ -12,7 +12,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -33,8 +33,8 @@ type githubConfig struct {
ClientSecret string
}
func newGithubConfig(v map[string]interface{}) (df.Dynamic, error) {
return df.New[githubConfig](v)
func newGithubConfig(v map[string]interface{}) (dd.Dynamic, error) {
return dd.New[githubConfig](v)
}
func (c *githubConfig) Type() string { return "github" }
+3 -3
View File
@@ -12,7 +12,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/sirupsen/logrus"
"github.com/zitadel/oidc/v2/pkg/client/rp"
@@ -32,8 +32,8 @@ type googleConfig struct {
ClientSecret string
}
func newGoogleConfig(v map[string]interface{}) (df.Dynamic, error) {
return df.New[googleConfig](v)
func newGoogleConfig(v map[string]interface{}) (dd.Dynamic, error) {
return dd.New[googleConfig](v)
}
func (c *googleConfig) Type() string { return "google" }
+3 -3
View File
@@ -11,7 +11,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/sirupsen/logrus"
"github.com/zitadel/oidc/v3/pkg/client/rp"
@@ -33,8 +33,8 @@ type oidcConfig struct {
Pkce bool
}
func newOidcConfig(v map[string]interface{}) (df.Dynamic, error) {
return df.New[oidcConfig](v)
func newOidcConfig(v map[string]interface{}) (dd.Dynamic, error) {
return dd.New[oidcConfig](v)
}
func (c *oidcConfig) Type() string { return "oidc" }
+8 -8
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"time"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/pkg/errors"
@@ -39,9 +39,9 @@ type OauthConfig struct {
CookieDomain string
SessionLifetime time.Duration
IntermediateLifetime time.Duration
SigningKey string `df:"+secret"`
EncryptionKey string `df:"+secret"`
Providers []df.Dynamic `df:"+secret"`
SigningKey string `dd:"+secret"`
EncryptionKey string `dd:"+secret"`
Providers []dd.Dynamic `dd:"+secret"`
}
func DefaultConfig() *Config {
@@ -52,14 +52,14 @@ func DefaultConfig() *Config {
}
func (c *Config) Load(path string) error {
opts := &df.Options{
DynamicBinders: map[string]func(map[string]any) (df.Dynamic, error){
opts := &dd.Options{
DynamicBinders: map[string]func(map[string]any) (dd.Dynamic, error){
(&githubConfig{}).Type(): newGithubConfig,
(&googleConfig{}).Type(): newGoogleConfig,
(&oidcConfig{}).Type(): newOidcConfig,
},
}
if err := df.MergeFromYAML(c, path, opts); err != nil {
if err := dd.MergeFromYAML(c, path, opts); err != nil {
return errors.Wrapf(err, "error loading frontend config '%v'", path)
}
if c.V != V {
@@ -75,7 +75,7 @@ func configureOauth(ctx context.Context, cfg *Config, tls bool) error {
}
for _, v := range cfg.Oauth.Providers {
if prvCfg, ok := v.(df.Dynamic); ok {
if prvCfg, ok := v.(dd.Dynamic); ok {
switch prvCfg.Type() {
case "github":
githubCfg, ok := prvCfg.(*githubConfig)
+3 -3
View File
@@ -11,7 +11,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -28,8 +28,8 @@ type githubConfig struct {
ClientSecret string
}
func newGithubConfig(v map[string]interface{}) (df.Dynamic, error) {
return df.New[githubConfig](v)
func newGithubConfig(v map[string]interface{}) (dd.Dynamic, error) {
return dd.New[githubConfig](v)
}
func (c *githubConfig) Type() string { return "github" }
+3 -3
View File
@@ -11,7 +11,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/sirupsen/logrus"
"github.com/zitadel/oidc/v2/pkg/client/rp"
@@ -27,8 +27,8 @@ type googleConfig struct {
ClientSecret string
}
func newGoogleConfig(v map[string]interface{}) (df.Dynamic, error) {
return df.New[googleConfig](v)
func newGoogleConfig(v map[string]interface{}) (dd.Dynamic, error) {
return dd.New[googleConfig](v)
}
func (c *googleConfig) Type() string { return "google" }
+3 -3
View File
@@ -10,7 +10,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
"github.com/michaelquigley/df"
"github.com/michaelquigley/df/dd"
"github.com/openziti/zrok/endpoints/proxyUi"
"github.com/sirupsen/logrus"
"github.com/zitadel/oidc/v3/pkg/client/rp"
@@ -28,8 +28,8 @@ type oidcConfig struct {
Pkce bool
}
func newOidcConfig(v map[string]interface{}) (df.Dynamic, error) {
return df.New[oidcConfig](v)
func newOidcConfig(v map[string]interface{}) (dd.Dynamic, error) {
return dd.New[oidcConfig](v)
}
func (c *oidcConfig) Type() string { return "oidc" }
+1 -1
View File
@@ -35,7 +35,7 @@ require (
github.com/kolesnikovae/go-winjob v1.0.0
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.18
github.com/michaelquigley/df v0.2.9
github.com/michaelquigley/df v0.3.0
github.com/michaelquigley/pfxlog v0.6.10
github.com/muesli/reflow v0.3.0
github.com/net-byte/vtun v1.7.0
+2 -2
View File
@@ -696,8 +696,8 @@ github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQ
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mholt/acmez/v3 v3.0.0 h1:r1NcjuWR0VaKP2BTjDK9LRFBw/WvURx3jlaEUl9Ht8E=
github.com/mholt/acmez/v3 v3.0.0/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
github.com/michaelquigley/df v0.2.9 h1:G7c1oJN8M33IozcRG7BhVKqUn+YY/ddxJxOfXlfeSqc=
github.com/michaelquigley/df v0.2.9/go.mod h1:Ym3uLqdbI6DxhqzLLtAzQ2ry7KfPKCjfXEgoOL23xfI=
github.com/michaelquigley/df v0.3.0 h1:LftBDBNNishz8jRAKhzd6qtqmjYgWZyZ6ZZkDtwMQuM=
github.com/michaelquigley/df v0.3.0/go.mod h1:Ym3uLqdbI6DxhqzLLtAzQ2ry7KfPKCjfXEgoOL23xfI=
github.com/michaelquigley/pfxlog v0.6.10 h1:IbC/H3MmSDcPlQHF1UZPQU13Dkrs0+ycWRyQd2ihnjw=
github.com/michaelquigley/pfxlog v0.6.10/go.mod h1:gEiNTfKEX6cJHSwRpOuqBpc8oYrlhMiDK/xMk/gV7D0=
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=