diff --git a/go.mod b/go.mod index 636a70c18..085bbc595 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,6 @@ require ( github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mholt/archiver/v3 v3.5.0 github.com/olekukonko/tablewriter v0.0.5 - github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/pierrec/lz4/v4 v4.1.3 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rjeczalik/notify v0.9.2 diff --git a/go.sum b/go.sum index 871ef1420..0350c52cc 100644 --- a/go.sum +++ b/go.sum @@ -385,8 +385,6 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= -github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/pierrec/lz4/v4 v4.0.3/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.3 h1:/dvQpkb0o1pVlSgKNQqfkavlnXaIK+hJ0LXsKRUN9D4= github.com/pierrec/lz4/v4 v4.1.3/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= diff --git a/internal/branding/branding.go b/internal/branding/branding.go index 4e18a96a0..03803c670 100644 --- a/internal/branding/branding.go +++ b/internal/branding/branding.go @@ -12,7 +12,6 @@ import ( "github.com/auth0/auth0-cli/internal/open" "github.com/guiguan/caster" - "github.com/phayes/freeport" "github.com/rjeczalik/notify" ) @@ -36,16 +35,11 @@ func PreviewCustomTemplate(ctx context.Context, templateData TemplateData) { ctx, cancel := context.WithCancel(ctx) defer cancel() - address := "localhost" - port, err := freeport.GetFreePort() - if err != nil { - return - } - - listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", address, port)) + listener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { return } + address := listener.Addr().String() requestTimeout := 10 * time.Minute server := &http.Server{ @@ -61,7 +55,7 @@ func PreviewCustomTemplate(ctx context.Context, templateData TemplateData) { } }() - err = open.URL(fmt.Sprintf("http://%s:%d/data/storybook/?path=/story/universal-login--prompts", address, port)) + err = open.URL(fmt.Sprintf("http://%s/data/storybook/?path=/story/universal-login--prompts", address)) if err != nil { return } diff --git a/vendor/github.com/phayes/freeport/.gitignore b/vendor/github.com/phayes/freeport/.gitignore deleted file mode 100644 index 1521c8b76..000000000 --- a/vendor/github.com/phayes/freeport/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/vendor/github.com/phayes/freeport/.goreleaser.yml b/vendor/github.com/phayes/freeport/.goreleaser.yml deleted file mode 100644 index 48044ea39..000000000 --- a/vendor/github.com/phayes/freeport/.goreleaser.yml +++ /dev/null @@ -1,134 +0,0 @@ -project_name: freeport - -release: - github: - owner: phayes - name: freeport - -builds: - - binary: freeport - goos: - - linux - - darwin - goarch: - - amd64 - - "386" - goarm: - - "6" - main: ./cmd/freeport - ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} - -archive: - format: tar.gz - name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ - .Arm }}{{ end }}' - files: - - licence* - - LICENCE* - - license* - - LICENSE* - - readme* - - README* - - changelog* - - CHANGELOG* - -snapshot: - name_template: SNAPSHOT-{{ .Commit }} - -checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' - -# Create RPM and .DEB files -fpm: - vendor: Patrick Hayes - - # Your app's homepage. - #homepage: https://example.com/ - - # Your app's maintainer - maintainer: Patrick Hayes - - # Your app's description. - description: Get a free open TCP port that is ready to use. - - # Your app's license. - # Default is empty. - license: BSD - - # Formats to be generated. - formats: - - deb - - rpm - - # Packages your package depends on. - #dependencies: - # - git - # - zsh - - # Packages that conflict with your package. - #conflicts: - # - svn - # - bash - - # Files or directories to add to your package (beyond the binary). - # Keys are source paths to get the files from. - # Values are the destination locations of the files in the package. - #files: - # "scripts/etc/init.d/": "/etc/init.d" - -# Homebrew repos -brew: - # Reporitory to push the tap to. - github: - owner: phayes - name: homebrew-repo - - # Git author used to commit to the repository. - # Defaults are shown. - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - - # Folder inside the repository to put the formula. - # Default is the root folder. - # folder: . - - # Caveats for the user of your binary. - # Default is empty. - # caveats: "How to use this binary" - - # Your app's homepage. - # Default is empty. - # homepage: "https://example.com/" - - # Your app's description. - # Default is empty. - description: "Get a free open TCP port that is ready to use." - - # Packages your package depends on. - #dependencies: - # - git - # - zsh - - # Packages that conflict with your package. - #conflicts: - # - svn - # - bash - - # Specify for packages that run as a service. - # Default is empty. - #plist: | - # - # ... - - # So you can `brew test` your formula. - # Default is empty. - #test: | - # system "#{bin}/program --version" - # ... - - # Custom install script for brew. - # Default is 'bin.install "program"'. - #install: | - # bin.install "program" - # ... \ No newline at end of file diff --git a/vendor/github.com/phayes/freeport/LICENSE.md b/vendor/github.com/phayes/freeport/LICENSE.md deleted file mode 100644 index d9882e595..000000000 --- a/vendor/github.com/phayes/freeport/LICENSE.md +++ /dev/null @@ -1,15 +0,0 @@ -Open Source License (BSD 3-Clause) ----------------------------------- - -Copyright (c) 2014, Patrick Hayes / HighWire Press -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/phayes/freeport/README.md b/vendor/github.com/phayes/freeport/README.md deleted file mode 100644 index 1665ccf4d..000000000 --- a/vendor/github.com/phayes/freeport/README.md +++ /dev/null @@ -1,58 +0,0 @@ -FreePort -======== - -Get a free open TCP port that is ready to use. - -## Command Line Example: -```bash -# Ask the kernel to give us an open port. -export port=$(freeport) - -# Start standalone httpd server for testing -httpd -X -c "Listen $port" & - -# Curl local server on the selected port -curl localhost:$port -``` - -## Golang example: -```go -package main - -import "github.com/phayes/freeport" - -func main() { - port, err := freeport.GetFreePort() - if err != nil { - log.Fatal(err) - } - // port is ready to listen on -} - -``` - -## Installation - -#### Mac OSX -```bash -brew install phayes/repo/freeport -``` - - -#### CentOS and other RPM based systems -```bash -wget https://github.com/phayes/freeport/releases/download/1.0.2/freeport_1.0.2_linux_386.rpm -rpm -Uvh freeport_1.0.2_linux_386.rpm -``` - -#### Ubuntu and other DEB based systems -```bash -wget wget https://github.com/phayes/freeport/releases/download/1.0.2/freeport_1.0.2_linux_amd64.deb -dpkg -i freeport_1.0.2_linux_amd64.deb -``` - -#### Building From Source -```bash -sudo apt-get install golang # Download go. Alternativly build from source: https://golang.org/doc/install/source -go get github.com/phayes/freeport -``` diff --git a/vendor/github.com/phayes/freeport/freeport.go b/vendor/github.com/phayes/freeport/freeport.go deleted file mode 100644 index fcfb6bab0..000000000 --- a/vendor/github.com/phayes/freeport/freeport.go +++ /dev/null @@ -1,49 +0,0 @@ -package freeport - -import ( - "net" -) - -// GetFreePort asks the kernel for a free open port that is ready to use. -func GetFreePort() (int, error) { - addr, err := net.ResolveTCPAddr("tcp", "localhost:0") - if err != nil { - return 0, err - } - - l, err := net.ListenTCP("tcp", addr) - if err != nil { - return 0, err - } - defer l.Close() - return l.Addr().(*net.TCPAddr).Port, nil -} - -// GetPort is deprecated, use GetFreePort instead -// Ask the kernel for a free open port that is ready to use -func GetPort() int { - port, err := GetFreePort() - if err != nil { - panic(err) - } - return port -} - -// GetFreePort asks the kernel for free open ports that are ready to use. -func GetFreePorts(count int) ([]int, error) { - var ports []int - for i := 0; i < count; i++ { - addr, err := net.ResolveTCPAddr("tcp", "localhost:0") - if err != nil { - return nil, err - } - - l, err := net.ListenTCP("tcp", addr) - if err != nil { - return nil, err - } - defer l.Close() - ports = append(ports, l.Addr().(*net.TCPAddr).Port) - } - return ports, nil -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 8e730c6d6..87f605792 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -196,9 +196,6 @@ github.com/nwaples/rardecode github.com/olekukonko/tablewriter # github.com/pelletier/go-toml v1.2.0 github.com/pelletier/go-toml -# github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 -## explicit -github.com/phayes/freeport # github.com/pierrec/lz4/v4 v4.1.3 ## explicit github.com/pierrec/lz4/v4