Skip to content

Commit

Permalink
Remove unused Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna committed Oct 29, 2024
1 parent 76bcf64 commit ba74e88
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
10 changes: 2 additions & 8 deletions x/configurl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,22 @@ type Config struct {
BaseConfig *Config
}

// Provider creates an instance from a config.
type Provider[ObjectType any] interface {
NewInstance(ctx context.Context, config *Config) (ObjectType, error)
}

// BuildFunc is a convenience type for functions that create a instances of ObjectType given a [Config].
// BuildFunc is a function that creates an instance of ObjectType given a [Config].
type BuildFunc[ObjectType any] func(ctx context.Context, config *Config) (ObjectType, error)

// TypeRegistry registers config types.
type TypeRegistry[ObjectType any] interface {
RegisterType(subtype string, newInstance BuildFunc[ObjectType]) error
}

// ExtensibleProvider is [Provider] implementation that can be extended via its [TypeRegistry] interface.
// ExtensibleProvider creates instances of ObjectType in a way that can be extended via its [TypeRegistry] interface.
type ExtensibleProvider[ObjectType comparable] struct {
// Instance to return when config is nil.
BaseInstance ObjectType
builders map[string]BuildFunc[ObjectType]
}

var (
_ Provider[any] = (*ExtensibleProvider[any])(nil)
_ BuildFunc[any] = (*ExtensibleProvider[any])(nil).NewInstance
_ TypeRegistry[any] = (*ExtensibleProvider[any])(nil)
)
Expand Down
17 changes: 17 additions & 0 deletions x/examples/fetch-psiphon/psiphon.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"SponsorId" : "DB4A6B5E997A4E48",
"PropagationChannelId" : "60F2A5F62855A295",

"ClientPlatform" : "outline",
"ClientVersion" : "1",

"DisableLocalSocksProxy" : true,
"DisableLocalHTTPProxy" : true,

"ObfuscatedServerListRootURLs" : [{"URL": "aHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3BzaXBob24vd2ViL29jdmwtMG9iai1zMnZnL29zbA==", "OnlyAfterAttempts": 0, "SkipVerify": false}, {"URL": "aHR0cHM6Ly93d3cucmVzdWx0c3VuaXZlcnNhbHVubGltaXRlZGpoLmNvbS93ZWIvb2N2bC0wb2JqLXMydmcvb3Ns", "OnlyAfterAttempts": 2, "SkipVerify": true}, {"URL": "aHR0cHM6Ly93d3cuYnJhbmRpbmd1c2FnYW1lcmVwLmNvbS93ZWIvb2N2bC0wb2JqLXMydmcvb3Ns", "OnlyAfterAttempts": 2, "SkipVerify": true}, {"URL": "aHR0cHM6Ly93d3cuYmxvZ3NmbWNhbmNlcmNpdGl6ZW4uY29tL3dlYi9vY3ZsLTBvYmotczJ2Zy9vc2w=", "OnlyAfterAttempts": 2, "SkipVerify": true}],
"RemoteServerListURLs" : [{"URL": "aHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3BzaXBob24vd2ViL29jdmwtMG9iai1zMnZnL3NlcnZlcl9saXN0X2NvbXByZXNzZWQ=", "OnlyAfterAttempts": 0, "SkipVerify": false}, {"URL": "aHR0cHM6Ly93d3cucmVzdWx0c3VuaXZlcnNhbHVubGltaXRlZGpoLmNvbS93ZWIvb2N2bC0wb2JqLXMydmcvc2VydmVyX2xpc3RfY29tcHJlc3NlZA==", "OnlyAfterAttempts": 2, "SkipVerify": true}, {"URL": "aHR0cHM6Ly93d3cuYnJhbmRpbmd1c2FnYW1lcmVwLmNvbS93ZWIvb2N2bC0wb2JqLXMydmcvc2VydmVyX2xpc3RfY29tcHJlc3NlZA==", "OnlyAfterAttempts": 2, "SkipVerify": true}, {"URL": "aHR0cHM6Ly93d3cuYmxvZ3NmbWNhbmNlcmNpdGl6ZW4uY29tL3dlYi9vY3ZsLTBvYmotczJ2Zy9zZXJ2ZXJfbGlzdF9jb21wcmVzc2Vk", "OnlyAfterAttempts": 2, "SkipVerify": true}],
"RemoteServerListSignaturePublicKey" : "MIICIDANBgkqhkiG9w0BAQEFAAOCAg0AMIICCAKCAgEAt7Ls+/39r+T6zNW7GiVpJfzq/xvL9SBH5rIFnk0RXYEYavax3WS6HOD35eTAqn8AniOwiH+DOkvgSKF2caqk/y1dfq47Pdymtwzp9ikpB1C5OfAysXzBiwVJlCdajBKvBZDerV1cMvRzCKvKwRmvDmHgphQQ7WfXIGbRbmmk6opMBh3roE42KcotLFtqp0RRwLtcBRNtCdsrVsjiI1Lqz/lH+T61sGjSjQ3CHMuZYSQJZo/KrvzgQXpkaCTdbObxHqb6/+i1qaVOfEsvjoiyzTxJADvSytVtcTjijhPEV6XskJVHE1Zgl+7rATr/pDQkw6DPCNBS1+Y6fy7GstZALQXwEDN/qhQI9kWkHijT8ns+i1vGg00Mk/6J75arLhqcodWsdeG/M/moWgqQAnlZAGVtJI1OgeF5fsPpXu4kctOfuZlGjVZXQNW34aOzm8r8S0eVZitPlbhcPiR4gT/aSMz/wd8lZlzZYsje/Jr8u/YtlwjjreZrGRmG8KMOzukV3lLmMppXFMvl4bxv6YFEmIuTsOhbLTwFgh7KYNjodLj/LsqRVfwz31PgWQFTEPICV7GCvgVlPRxnofqKSjgTWI4mxDhBpVcATvaoBl1L/6WLbFvBsoAUBItWwctO2xalKxF5szhGm8lccoc5MZr8kfE0uxMgsxz4er68iCID+rsCAQM=",
"ServerEntrySignaturePublicKey" : "sHuUVTWaRyh5pZwy4UguSgkwmBe0EHtJJkoF5WrxmvA=",

"TargetApiProtocol" : "ssh"
}

0 comments on commit ba74e88

Please sign in to comment.