Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
*: rename everything to the final name
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Philips committed Jul 3, 2019
1 parent e46d6d5 commit 6c02b98
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ before:
# you may remove this if you don't use vgo
- go mod download
build:
main: ./sget
main: ./rget
env:
- CGO_ENABLED=0
goos:
Expand Down
2 changes: 1 addition & 1 deletion autocert/autocert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"testing"
"time"

"github.com/philips/sget/autocert/internal/acmetest"
"github.com/merklecounty/rget/autocert/internal/acmetest"
"golang.org/x/crypto/acme"
)

Expand Down
2 changes: 1 addition & 1 deletion gitcache/gitcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing/object"
githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"

"github.com/philips/sget/autocert"
"github.com/merklecounty/rget/autocert"
)

type GitCache struct {
Expand Down
2 changes: 1 addition & 1 deletion gitcache/gitcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"testing"

"github.com/philips/sget/autocert"
"github.com/merklecounty/rget/autocert"
)

func TestDirCache(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/philips/sget
module github.com/merklecounty/rget

go 1.12

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sget/cmd/github.go → rget/cmd/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package cmd
import (
"github.com/spf13/cobra"

"github.com/philips/sget/sget/github"
"github.com/merklecounty/rget/rget/github"
)

// githubCmd represents the github command
Expand Down
30 changes: 15 additions & 15 deletions sget/cmd/root.go → rget/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ import (
"github.com/google/certificate-transparency-go/x509"
"github.com/google/certificate-transparency-go/x509util"

"github.com/philips/sget/sgetct"
"github.com/philips/sget/sgethash"
"github.com/philips/sget/sgetwellknown"
"github.com/merklecounty/rget/rgetct"
"github.com/merklecounty/rget/rgethash"
"github.com/merklecounty/rget/rgetwellknown"
)

var cfgFile string

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "sget [URL]",
Use: "rget [URL]",
Short: "Get a URL and verify the contents with CT Log backed transparency",
Long: `sget is similar to other popular URL fetchers with an additional layer of security.
Long: `rget is similar to other popular URL fetchers with an additional layer of security.
By using the Certificate Transparency Log infrastructure that enables third-party auditing of
the web's certificate authority infrastructure sget can give you strong guarantees that the
the web's certificate authority infrastructure rget can give you strong guarantees that the
cryptographic hash digest of the binary you are downloading appears in a public log.
`,

Expand All @@ -71,7 +71,7 @@ func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.sget.yaml)")
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.rget.yaml)")

// Cobra also supports local flags, which will only run
// when this action is called directly.
Expand All @@ -91,9 +91,9 @@ func initConfig() {
os.Exit(1)
}

// Search config in home directory with name ".sget" (without extension).
// Search config in home directory with name ".rget" (without extension).
viper.AddConfigPath(home)
viper.SetConfigName(".sget")
viper.SetConfigName(".rget")
}

viper.AutomaticEnv() // read in environment variables that match
Expand All @@ -112,7 +112,7 @@ func get(cmd *cobra.Command, args []string) {
durl := args[0]

// Step 1: Download the SHA256SUMS that is correct for the URL
prefix, err := sgetwellknown.SumPrefix(durl)
prefix, err := rgetwellknown.SumPrefix(durl)
sumsURL := prefix + "SHA256SUMS"
fmt.Printf("Downloading sums file: %v\n", sumsURL)
response, err := http.Get(sumsURL)
Expand All @@ -131,14 +131,14 @@ func get(cmd *cobra.Command, args []string) {
}

// Step 2. Generate the CT URL from the SHA256SUMS file
domain, err := sgetwellknown.Domain(durl)
domain, err := rgetwellknown.Domain(durl)
if err != nil {
fmt.Printf("wellknown domain error: %v", err)
os.Exit(1)
}

sums := sgethash.FromSHA256SumFile(string(sha256file))
cturl := "https://" + sums.Domain() + "." + domain + "." + sgetwellknown.PublicServiceHost
sums := rgethash.FromSHA256SumFile(string(sha256file))
cturl := "https://" + sums.Domain() + "." + domain + "." + rgetwellknown.PublicServiceHost

hc := &http.Client{Timeout: 30 * time.Second}
ctx := context.Background()
Expand All @@ -158,15 +158,15 @@ func get(cmd *cobra.Command, args []string) {

// Get chain served online for TLS connection to site, and check any SCTs
// provided alongside on the connection along the way.
chain, valid, invalid, err = sgetct.GetAndCheckSiteChain(ctx, lf, cturl, ll, hc)
chain, valid, invalid, err = rgetct.GetAndCheckSiteChain(ctx, lf, cturl, ll, hc)
if err != nil {
panic(fmt.Sprintf("%s: failed to get cert chain: %v", cturl, err))
}
fmt.Printf("Found %d external SCTs for %q, of which %d were validated\n", (valid + invalid), cturl, valid)
totalInvalid += invalid

// Check the chain for embedded SCTs.
valid, invalid = sgetct.CheckChain(ctx, lf, chain, ll, hc)
valid, invalid = rgetct.CheckChain(ctx, lf, chain, ll, hc)
fmt.Printf("Found %d embedded SCTs for %q, of which %d were validated\n", (valid + invalid), domain, valid)
totalInvalid += invalid

Expand Down
24 changes: 12 additions & 12 deletions sget/cmd/server.go → rget/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ import (
"github.com/spf13/cobra"
githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"

"github.com/philips/sget/autocert"
"github.com/philips/sget/gitcache"
"github.com/philips/sget/sgethash"
"github.com/philips/sget/sgetwellknown"
"github.com/merklecounty/rget/autocert"
"github.com/merklecounty/rget/gitcache"
"github.com/merklecounty/rget/rgethash"
"github.com/merklecounty/rget/rgetwellknown"
)

// serverCmd represents the server command
var serverCmd = &cobra.Command{
Use: "server",
Short: "sget API server and TLS server",
Short: "rget API server and TLS server",
Long: `Provides an HTTP and HTTPS server that saves into two different
git repos one with TLS secrets and one with public data that can be audited.`,
Run: server,
Expand Down Expand Up @@ -79,7 +79,7 @@ func (r sumRepo) handler(resp http.ResponseWriter, req *http.Request) {
}
}

sums := sgethash.FromSHA256SumFile(string(sha256file))
sums := rgethash.FromSHA256SumFile(string(sha256file))

// Step 2: Save the file contents to the git repo by domain
gc := gitcache.GitCache(r)
Expand All @@ -106,7 +106,7 @@ func (r sumRepo) handler(resp http.ResponseWriter, req *http.Request) {
}

// Step 3. Create the Certificate object for the domain and save that as well
domain, err := sgetwellknown.Domain(sumsURL)
domain, err := rgetwellknown.Domain(sumsURL)
if err != nil {
fmt.Printf("wellknown domain error: %v\n", err)
resp.WriteHeader(http.StatusOK)
Expand Down Expand Up @@ -153,15 +153,15 @@ func server(cmd *cobra.Command, args []string) {
}

hostPolicyNoLog := func(ctx context.Context, host string) ([]string, error) {
if sgetwellknown.PublicServiceHost == host {
if rgetwellknown.PublicServiceHost == host {
return []string{host}, nil
}

if !strings.HasSuffix(host, "."+sgetwellknown.PublicServiceHost) {
return nil, errors.New(fmt.Sprintf("not in TLD %v", sgetwellknown.PublicServiceHost))
if !strings.HasSuffix(host, "."+rgetwellknown.PublicServiceHost) {
return nil, errors.New(fmt.Sprintf("not in TLD %v", rgetwellknown.PublicServiceHost))
}

key := strings.TrimSuffix(host, "."+sgetwellknown.PublicServiceHost)
key := strings.TrimSuffix(host, "."+rgetwellknown.PublicServiceHost)

// Reduce to the shortest domain
parts := strings.Split(key, ".")
Expand All @@ -183,7 +183,7 @@ func server(cmd *cobra.Command, args []string) {
}

for i := range matches {
matches[i] = matches[i] + "." + sgetwellknown.PublicServiceHost
matches[i] = matches[i] + "." + rgetwellknown.PublicServiceHost
}

return matches, nil
Expand Down
4 changes: 2 additions & 2 deletions sget/cmd/submit.go → rget/cmd/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"net/http"
"net/url"

"github.com/philips/sget/sgetwellknown"
"github.com/merklecounty/rget/rgetwellknown"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -51,7 +51,7 @@ func init() {
}

func submit(cmd *cobra.Command, args []string) {
resp, err := http.PostForm("https://"+sgetwellknown.PublicServiceHost, url.Values{
resp, err := http.PostForm("https://"+rgetwellknown.PublicServiceHost, url.Values{
"url": {args[0]},
})
defer resp.Body.Close()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/google/go-github/v24/github"
"github.com/spf13/cobra"

"github.com/philips/sget/sgethash"
"github.com/philips/sget/sgetwellknown"
"github.com/merklecounty/rget/rgethash"
"github.com/merklecounty/rget/rgetwellknown"
)

var generateReleaseSumsCmd = &cobra.Command{
Expand All @@ -19,7 +19,7 @@ var generateReleaseSumsCmd = &cobra.Command{
which is printed out to stdout.
example:
sget generate-release-sums https://github.com/github/hub/releases/tag/v2.12.1
rget generate-release-sums https://github.com/github/hub/releases/tag/v2.12.1
`,
Run: generateReleaseSumsMain,
}
Expand All @@ -35,7 +35,7 @@ func generateReleaseSumsMain(cmd *cobra.Command, args []string) {
os.Exit(1)
}

m, err := sgetwellknown.GitHubMatches(args[0])
m, err := rgetwellknown.GitHubMatches(args[0])
if err != nil {
fmt.Printf("matches: %v\n", err)
os.Exit(1)
Expand All @@ -52,7 +52,7 @@ func generateReleaseSumsMain(cmd *cobra.Command, args []string) {
os.Exit(1)
}

urls := sgethash.URLSumList{}
urls := rgethash.URLSumList{}
for _, r := range releases {
for _, a := range r.Assets {
urls.AddURL(*a.BrowserDownloadURL)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/spf13/cobra"
"golang.org/x/oauth2"

"github.com/philips/sget/sgethash"
"github.com/philips/sget/sgetwellknown"
"github.com/merklecounty/rget/rgethash"
"github.com/merklecounty/rget/rgetwellknown"
)

var publishReleaseSumsCmd = &cobra.Command{
Expand All @@ -34,7 +34,7 @@ func publishReleaseSumsMain(cmd *cobra.Command, args []string) {
os.Exit(1)
}

m, err := sgetwellknown.GitHubMatches(args[0])
m, err := rgetwellknown.GitHubMatches(args[0])
if err != nil {
fmt.Printf("matches: %v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -68,7 +68,7 @@ func publishReleaseSumsMain(cmd *cobra.Command, args []string) {
os.Exit(1)
}

urls := sgethash.URLSumList{}
urls := rgethash.URLSumList{}
for _, r := range releases {
for _, a := range r.Assets {
urls.AddURL(*a.BrowserDownloadURL)
Expand All @@ -88,7 +88,7 @@ func publishReleaseSumsMain(cmd *cobra.Command, args []string) {
func uploadSums(client *github.Client, owner, repo, tag string, release github.RepositoryRelease, content []byte) {
ctx := context.Background()

tmpfile, err := ioutil.TempFile("", "sget*")
tmpfile, err := ioutil.TempFile("", "rget*")
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion sget/main.go → rget/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package main

import "github.com/philips/sget/sget/cmd"
import "github.com/merklecounty/rget/rget/cmd"

func main() {
cmd.Execute()
Expand Down
2 changes: 1 addition & 1 deletion sgetct/ct.go → rgetct/ct.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sgetct
package rgetct

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion sgethash/sgethash.go → rgethash/sgethash.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sgethash
package rgethash

import (
"bufio"
Expand Down
2 changes: 1 addition & 1 deletion sgethash/sgethash_test.go → rgethash/sgethash_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sgethash
package rgethash

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion sgetwellknown/wellknown.go → rgetwellknown/wellknown.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sgetwellknown
package rgetwellknown

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sgetwellknown
package rgetwellknown

import (
"testing"
Expand Down

0 comments on commit 6c02b98

Please sign in to comment.