Skip to content
Permalink
Browse files

*: rename everything to the final name

  • Loading branch information
philips committed Jul 3, 2019
1 parent e46d6d5 commit 6c02b9803154ca8d11a68f42afc9894f7e975f4d
@@ -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:
@@ -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"
)

@@ -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 {
@@ -8,7 +8,7 @@ import (
"reflect"
"testing"

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

func TestDirCache(t *testing.T) {
2 go.mod
@@ -1,4 +1,4 @@
module github.com/philips/sget
module github.com/merklecounty/rget

go 1.12

File renamed without changes.
@@ -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
@@ -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.
`,

@@ -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.
@@ -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
@@ -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)
@@ -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()
@@ -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

@@ -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,
@@ -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)
@@ -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)
@@ -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, ".")
@@ -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
@@ -19,7 +19,7 @@ import (
"net/http"
"net/url"

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

@@ -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()
File renamed without changes.
@@ -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{
@@ -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,
}
@@ -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)
@@ -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)
File renamed without changes.
@@ -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{
@@ -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)
@@ -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)
@@ -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)
@@ -14,7 +14,7 @@

package main

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

func main() {
cmd.Execute()
@@ -1,4 +1,4 @@
package sgetct
package rgetct

import (
"context"
@@ -1,4 +1,4 @@
package sgethash
package rgethash

import (
"bufio"
@@ -1,4 +1,4 @@
package sgethash
package rgethash

import (
"testing"
@@ -1,4 +1,4 @@
package sgetwellknown
package rgetwellknown

import (
"errors"
@@ -1,4 +1,4 @@
package sgetwellknown
package rgetwellknown

import (
"testing"

0 comments on commit 6c02b98

Please sign in to comment.
You can’t perform that action at this time.