diff --git a/x/config/config.go b/x/configurl/config.go similarity index 99% rename from x/config/config.go rename to x/configurl/config.go index a5a73e24..f7b5d89d 100644 --- a/x/config/config.go +++ b/x/configurl/config.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "errors" diff --git a/x/config/config_test.go b/x/configurl/config_test.go similarity index 99% rename from x/config/config_test.go rename to x/configurl/config_test.go index a849ac34..c86d2192 100644 --- a/x/config/config_test.go +++ b/x/configurl/config_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "testing" diff --git a/x/config/dns.go b/x/configurl/dns.go similarity index 99% rename from x/config/dns.go rename to x/configurl/dns.go index 941fba41..01615271 100644 --- a/x/config/dns.go +++ b/x/configurl/dns.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "context" diff --git a/x/config/doc.go b/x/configurl/doc.go similarity index 99% rename from x/config/doc.go rename to x/configurl/doc.go index a34e3fa6..994aed41 100644 --- a/x/config/doc.go +++ b/x/configurl/doc.go @@ -145,4 +145,4 @@ where wrapStreamDialerWithCustom and wrapPacketDialerWithCustom implement [NewPa [Onion Routing]: https://en.wikipedia.org/wiki/Onion_routing */ -package config +package configurl diff --git a/x/config/override.go b/x/configurl/override.go similarity index 99% rename from x/config/override.go rename to x/configurl/override.go index 76c4a785..6f4406cd 100644 --- a/x/config/override.go +++ b/x/configurl/override.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "context" diff --git a/x/config/override_test.go b/x/configurl/override_test.go similarity index 99% rename from x/config/override_test.go rename to x/configurl/override_test.go index 6b2024a3..288d8964 100644 --- a/x/config/override_test.go +++ b/x/configurl/override_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "net/url" diff --git a/x/config/shadowsocks.go b/x/configurl/shadowsocks.go similarity index 99% rename from x/config/shadowsocks.go rename to x/configurl/shadowsocks.go index c65f7ba8..14ebf305 100644 --- a/x/config/shadowsocks.go +++ b/x/configurl/shadowsocks.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "encoding/base64" diff --git a/x/config/shadowsocks_test.go b/x/configurl/shadowsocks_test.go similarity index 99% rename from x/config/shadowsocks_test.go rename to x/configurl/shadowsocks_test.go index e9cc50c2..6779b765 100644 --- a/x/config/shadowsocks_test.go +++ b/x/configurl/shadowsocks_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "encoding/base64" diff --git a/x/config/socks5.go b/x/configurl/socks5.go similarity index 99% rename from x/config/socks5.go rename to x/configurl/socks5.go index 105f6817..196ccc51 100644 --- a/x/config/socks5.go +++ b/x/configurl/socks5.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "net/url" diff --git a/x/config/split.go b/x/configurl/split.go similarity index 98% rename from x/config/split.go rename to x/configurl/split.go index 654c9ba9..5a7b9321 100644 --- a/x/config/split.go +++ b/x/configurl/split.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "fmt" diff --git a/x/config/tls.go b/x/configurl/tls.go similarity index 99% rename from x/config/tls.go rename to x/configurl/tls.go index 3086249b..612c6ce5 100644 --- a/x/config/tls.go +++ b/x/configurl/tls.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "fmt" diff --git a/x/config/tls_test.go b/x/configurl/tls_test.go similarity index 99% rename from x/config/tls_test.go rename to x/configurl/tls_test.go index c0a0bcfc..5ed7fbe1 100644 --- a/x/config/tls_test.go +++ b/x/configurl/tls_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "net/url" diff --git a/x/config/websocket.go b/x/configurl/websocket.go similarity index 99% rename from x/config/websocket.go rename to x/configurl/websocket.go index 9d02c95c..14107485 100644 --- a/x/config/websocket.go +++ b/x/configurl/websocket.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package config +package configurl import ( "context" diff --git a/x/examples/fetch-speed/main.go b/x/examples/fetch-speed/main.go index 65807062..4bb94370 100644 --- a/x/examples/fetch-speed/main.go +++ b/x/examples/fetch-speed/main.go @@ -27,7 +27,7 @@ import ( "strings" "time" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" ) var debugLog log.Logger = *log.New(io.Discard, "", 0) @@ -58,7 +58,7 @@ func main() { os.Exit(1) } - dialer, err := config.NewDefaultConfigToDialer().NewStreamDialer(*transportFlag) + dialer, err := configurl.NewDefaultConfigToDialer().NewStreamDialer(*transportFlag) if err != nil { log.Fatalf("Could not create dialer: %v\n", err) } diff --git a/x/examples/fetch/main.go b/x/examples/fetch/main.go index 2fbfbaf4..a38a4edf 100644 --- a/x/examples/fetch/main.go +++ b/x/examples/fetch/main.go @@ -29,7 +29,7 @@ import ( "strings" "time" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" ) var debugLog log.Logger = *log.New(io.Discard, "", 0) @@ -84,7 +84,7 @@ func main() { os.Exit(1) } - dialer, err := config.NewDefaultConfigToDialer().NewStreamDialer(*transportFlag) + dialer, err := configurl.NewDefaultConfigToDialer().NewStreamDialer(*transportFlag) if err != nil { log.Fatalf("Could not create dialer: %v\n", err) } diff --git a/x/examples/http2transport/main.go b/x/examples/http2transport/main.go index f8299725..f3fdbeae 100644 --- a/x/examples/http2transport/main.go +++ b/x/examples/http2transport/main.go @@ -24,7 +24,7 @@ import ( "os/signal" "time" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "github.com/Jigsaw-Code/outline-sdk/x/httpproxy" ) @@ -34,7 +34,7 @@ func main() { urlProxyPrefixFlag := flag.String("urlProxyPrefix", "/proxy", "Path where to run the URL proxy. Set to empty (\"\") to disable it.") flag.Parse() - dialer, err := config.NewDefaultConfigToDialer().NewStreamDialer(*transportFlag) + dialer, err := configurl.NewDefaultConfigToDialer().NewStreamDialer(*transportFlag) if err != nil { log.Fatalf("Could not create dialer: %v", err) diff --git a/x/examples/outline-cli/outline_device.go b/x/examples/outline-cli/outline_device.go index 330ba024..bdb18643 100644 --- a/x/examples/outline-cli/outline_device.go +++ b/x/examples/outline-cli/outline_device.go @@ -24,7 +24,7 @@ import ( "github.com/Jigsaw-Code/outline-sdk/network" "github.com/Jigsaw-Code/outline-sdk/network/lwip2transport" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" ) const ( @@ -39,7 +39,7 @@ type OutlineDevice struct { svrIP net.IP } -var configToDialer = config.NewDefaultConfigToDialer() +var configToDialer = configurl.NewDefaultConfigToDialer() func NewOutlineDevice(transportConfig string) (od *OutlineDevice, err error) { ip, err := resolveShadowsocksServerIPFromConfig(transportConfig) diff --git a/x/examples/outline-cli/outline_packet_proxy.go b/x/examples/outline-cli/outline_packet_proxy.go index 73ef311b..b500ecc7 100644 --- a/x/examples/outline-cli/outline_packet_proxy.go +++ b/x/examples/outline-cli/outline_packet_proxy.go @@ -22,7 +22,7 @@ import ( "github.com/Jigsaw-Code/outline-sdk/network" "github.com/Jigsaw-Code/outline-sdk/network/dnstruncate" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "github.com/Jigsaw-Code/outline-sdk/x/connectivity" ) @@ -36,7 +36,7 @@ type outlinePacketProxy struct { func newOutlinePacketProxy(transportConfig string) (opp *outlinePacketProxy, err error) { opp = &outlinePacketProxy{} - if opp.remotePl, err = config.NewPacketListener(transportConfig); err != nil { + if opp.remotePl, err = configurl.NewPacketListener(transportConfig); err != nil { return nil, fmt.Errorf("failed to create UDP packet listener: %w", err) } if opp.remote, err = network.NewPacketProxyFromPacketListener(opp.remotePl); err != nil { diff --git a/x/examples/resolve/main.go b/x/examples/resolve/main.go index 0364a781..6395e1fa 100644 --- a/x/examples/resolve/main.go +++ b/x/examples/resolve/main.go @@ -27,7 +27,7 @@ import ( "time" "github.com/Jigsaw-Code/outline-sdk/dns" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "golang.org/x/net/dns/dnsmessage" ) @@ -66,7 +66,7 @@ func main() { resolverAddr := *resolverFlag var resolver dns.Resolver - configToDialer := config.NewDefaultConfigToDialer() + configToDialer := configurl.NewDefaultConfigToDialer() if *tcpFlag { streamDialer, err := configToDialer.NewStreamDialer(*transportFlag) if err != nil { diff --git a/x/examples/smart-proxy/main.go b/x/examples/smart-proxy/main.go index b695566e..b00963ff 100644 --- a/x/examples/smart-proxy/main.go +++ b/x/examples/smart-proxy/main.go @@ -27,7 +27,7 @@ import ( "time" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "github.com/Jigsaw-Code/outline-sdk/x/httpproxy" "github.com/Jigsaw-Code/outline-sdk/x/smart" ) @@ -86,7 +86,7 @@ func main() { log.Fatalf("Could not read config: %v", err) } - configToDialer := config.NewDefaultConfigToDialer() + configToDialer := configurl.NewDefaultConfigToDialer() packetDialer, err := configToDialer.NewPacketDialer(*transportFlag) if err != nil { log.Fatalf("Could not create packet dialer: %v", err) diff --git a/x/examples/test-connectivity/main.go b/x/examples/test-connectivity/main.go index 45b4ea8d..ee82e558 100644 --- a/x/examples/test-connectivity/main.go +++ b/x/examples/test-connectivity/main.go @@ -31,7 +31,7 @@ import ( "time" "github.com/Jigsaw-Code/outline-sdk/dns" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "github.com/Jigsaw-Code/outline-sdk/x/connectivity" "github.com/Jigsaw-Code/outline-sdk/x/report" ) @@ -161,7 +161,7 @@ func main() { success := false jsonEncoder := json.NewEncoder(os.Stdout) jsonEncoder.SetEscapeHTML(false) - configToDialer := config.NewDefaultConfigToDialer() + configToDialer := configurl.NewDefaultConfigToDialer() for _, resolverHost := range strings.Split(*resolverFlag, ",") { resolverHost := strings.TrimSpace(resolverHost) resolverAddress := net.JoinHostPort(resolverHost, "53") @@ -194,7 +194,7 @@ func main() { success = true } debugLog.Printf("Test %v %v result: %v", proto, resolverAddress, result) - sanitizedConfig, err := config.SanitizeConfig(*transportFlag) + sanitizedConfig, err := configurl.SanitizeConfig(*transportFlag) if err != nil { log.Fatalf("Failed to sanitize config: %v", err) } diff --git a/x/examples/ws2endpoint/main.go b/x/examples/ws2endpoint/main.go index 581c4d94..25c89a2c 100644 --- a/x/examples/ws2endpoint/main.go +++ b/x/examples/ws2endpoint/main.go @@ -26,7 +26,7 @@ import ( "time" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "golang.org/x/net/websocket" ) @@ -60,7 +60,7 @@ func main() { defer listener.Close() log.Printf("Proxy listening on %v\n", listener.Addr().String()) - config2Dialer := config.NewDefaultConfigToDialer() + config2Dialer := configurl.NewDefaultConfigToDialer() mux := http.NewServeMux() if *tcpPathFlag != "" { dialer, err := config2Dialer.NewStreamDialer(*transportFlag) diff --git a/x/httpproxy/connect_handler.go b/x/httpproxy/connect_handler.go index af0f755f..b68e6747 100644 --- a/x/httpproxy/connect_handler.go +++ b/x/httpproxy/connect_handler.go @@ -24,7 +24,7 @@ import ( "strings" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" ) type sanitizeErrorDialer struct { @@ -52,7 +52,7 @@ func (d *sanitizeErrorDialer) DialStream(ctx context.Context, addr string) (tran type connectHandler struct { dialer *sanitizeErrorDialer - dialerConfig *config.ConfigToDialer + dialerConfig *configurl.ConfigToDialer } var _ http.Handler = (*connectHandler)(nil) @@ -140,7 +140,7 @@ func (h *connectHandler) ServeHTTP(proxyResp http.ResponseWriter, proxyReq *http // the requests using the given [transport.StreamDialer]. // // Clients can specify a Transport header with a value of a transport config as specified in -// the [config] package to specify the transport for a given request. +// the [configurl] package to specify the transport for a given request. // // The resulting handler is currently vulnerable to probing attacks. It's ok as a localhost proxy // but it may be vulnerable if used as a public proxy. @@ -149,7 +149,7 @@ func NewConnectHandler(dialer transport.StreamDialer) http.Handler { // of the base dialer (e.g. access key credentials) to the user. sd := &sanitizeErrorDialer{dialer} // TODO(fortuna): Inject the config parser - dialerConfig := config.NewDefaultConfigToDialer() + dialerConfig := configurl.NewDefaultConfigToDialer() dialerConfig.BaseStreamDialer = sd return &connectHandler{sd, dialerConfig} } diff --git a/x/mobileproxy/mobileproxy.go b/x/mobileproxy/mobileproxy.go index 14397864..f396132b 100644 --- a/x/mobileproxy/mobileproxy.go +++ b/x/mobileproxy/mobileproxy.go @@ -32,7 +32,7 @@ import ( "time" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" "github.com/Jigsaw-Code/outline-sdk/x/httpproxy" "github.com/Jigsaw-Code/outline-sdk/x/smart" ) @@ -152,7 +152,7 @@ type StreamDialer struct { transport.StreamDialer } -var configToDialer = config.NewDefaultConfigToDialer() +var configToDialer = configurl.NewDefaultConfigToDialer() // NewStreamDialerFromConfig creates a [StreamDialer] based on the given config. // The config format is specified in https://pkg.go.dev/github.com/Jigsaw-Code/outline-sdk/x/config#hdr-Config_Format. diff --git a/x/smart/stream_dialer.go b/x/smart/stream_dialer.go index f6db7a77..3e745b1b 100644 --- a/x/smart/stream_dialer.go +++ b/x/smart/stream_dialer.go @@ -28,7 +28,7 @@ import ( "github.com/Jigsaw-Code/outline-sdk/dns" "github.com/Jigsaw-Code/outline-sdk/transport" - "github.com/Jigsaw-Code/outline-sdk/x/config" + "github.com/Jigsaw-Code/outline-sdk/x/configurl" ) // To test one strategy: @@ -231,7 +231,7 @@ func (f *StrategyFinder) findTLS(ctx context.Context, testDomains []string, base if len(tlsConfig) == 0 { return nil, errors.New("config for TLS is empty. Please specify at least one transport") } - var configToDialer = config.NewDefaultConfigToDialer() + var configToDialer = configurl.NewDefaultConfigToDialer() configToDialer.BaseStreamDialer = baseDialer ctx, searchDone := context.WithCancel(ctx)