docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
assert.Nil(t, tree.Search("")) assert.NotNil(t, tree.Search("localhost"))
<mask> node := tree.Search("example.com") <mask> assert.NotNil(t, node) <mask> assert.True(t, node.Data.(net.IP).Equal(localIP)) <mask> assert.NotNil(t, tree.Insert("", localIP)) <mask> } <mask> <mask> func TestTrie_Wildcard(t *testing.T) { <mask> tree := New() </s> Feature: add default hosts `localhost` </s> remove return nil, false </s> add if parts[0] == "" { return nil, false } return parts, true
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fb628e9c62d2576aff3643d4ff30610a0a92c76f
component/trie/domain_test.go
// add default hosts if err := tree.Insert("localhost", net.IP{127, 0, 0, 1}); err != nil { println(err.Error()) }
<mask> func parseHosts(cfg *RawConfig) (*trie.DomainTrie, error) { <mask> tree := trie.New() <mask> if len(cfg.Hosts) != 0 { <mask> for domain, ipStr := range cfg.Hosts { <mask> ip := net.ParseIP(ipStr) <mask> if ip == nil { </s> Feature: add default hosts `localhost` </s> remove return nil, false </s> add if parts[0] == "" { return nil, false } return parts, true
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fb628e9c62d2576aff3643d4ff30610a0a92c76f
config/config.go
func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) {
<mask> c = ss.client.New(c, parseVmessAddr(addr)) <mask> return &VmessAdapter{conn: c}, err <mask> } <mask> <mask> func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { <mask> security = strings.ToLower(security) <mask> client, err := vmess.NewClient(vmess.Config{ <mask> UUID: uuid, <mask> AlterID: alterID, <mask> Security: security, </s> Feature: support vmess tls mode </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
adapters/remote/vmess.go
TLS: option["tls"] == "true",
<mask> AlterID: alterID, <mask> Security: security, <mask> }) <mask> if err != nil { <mask> return nil, err <mask> } </s> Feature: support vmess tls mode </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option) </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) {
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
adapters/remote/vmess.go
"crypto/tls"
<mask> package vmess <mask> <mask> import ( <mask> "fmt" <mask> "math/rand" <mask> "net" <mask> "runtime" <mask> </s> Feature: support vmess tls mode </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
common/vmess/vmess.go
var tlsConfig = &tls.Config{ InsecureSkipVerify: true, }
<mask> "aes-128-gcm": SecurityAES128GCM, <mask> "chacha20-poly1305": SecurityCHACHA20POLY1305, <mask> } <mask> <mask> // Command types <mask> const ( <mask> CommandTCP byte = 1 <mask> CommandUDP byte = 2 <mask> ) <mask> </s> Feature: support vmess tls mode </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option) </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
common/vmess/vmess.go
tls bool
<mask> uuid *uuid.UUID <mask> security Security <mask> } <mask> <mask> // Config of vmess <mask> type Config struct { <mask> UUID string </s> Feature: support vmess tls mode </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) { </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
common/vmess/vmess.go
TLS bool
<mask> type Config struct { <mask> UUID string <mask> AlterID uint16 <mask> Security string <mask> } <mask> <mask> // New return a Conn with net.Conn and DstAddr <mask> func (c *Client) New(conn net.Conn, dst *DstAddr) net.Conn { <mask> r := rand.Intn(len(c.user)) <mask> if c.tls { </s> Feature: support vmess tls mode </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option) </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
common/vmess/vmess.go
if c.tls { conn = tls.Client(conn, tlsConfig) }
<mask> func (c *Client) New(conn net.Conn, dst *DstAddr) net.Conn { <mask> r := rand.Intn(len(c.user)) <mask> return newConn(conn, c.user[r], dst, c.security) <mask> } <mask> <mask> // NewClient return Client instance <mask> func NewClient(config Config) (*Client, error) { </s> Feature: support vmess tls mode </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) { </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
common/vmess/vmess.go
tls: config.TLS,
<mask> return &Client{ <mask> user: newAlterIDs(newID(&uid), config.AlterID), <mask> uuid: &uid, <mask> security: security, <mask> }, nil <mask> } </s> Feature: support vmess tls mode </s> remove vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) </s> add option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option) </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) {
[ "keep", "keep", "keep", "add", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
common/vmess/vmess.go
option := parseOptions(6, proxy...) vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5], option)
<mask> alterID, err := strconv.Atoi(proxy[4]) <mask> if err != nil { <mask> return err <mask> } <mask> vmess, err := adapters.NewVmess(key.Name(), addr, proxy[3], uint16(alterID), proxy[5]) <mask> if err != nil { <mask> return err <mask> } <mask> proxies[key.Name()] = vmess <mask> } </s> Feature: support vmess tls mode </s> remove func NewVmess(name string, server string, uuid string, alterID uint16, security string) (*Vmess, error) { </s> add func NewVmess(name string, server string, uuid string, alterID uint16, security string, option map[string]string) (*Vmess, error) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/fcb46e77069445ab00e12eb870837464f151abe1
config/config.go
<mask> linters-settings: <mask> gci: <mask> sections: <mask> - standard <mask> - prefix(github.com/Dreamacro/clash) <mask> - default <mask> staticcheck: <mask> go: '1.20' </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/.golangci.yaml
- prefix(github.com/Dreamacro/clash)
<mask> gci: <mask> sections: <mask> - standard <mask> - default <mask> staticcheck: <mask> go: '1.20' </s> Chore: make test linter happy </s> remove - prefix(github.com/Dreamacro/clash) </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/.golangci.yaml
GOOS=darwin golangci-lint run --fix ./... GOOS=linux golangci-lint run --fix ./...
<mask> lint: <mask> GOOS=darwin golangci-lint run ./... <mask> GOOS=linux golangci-lint run ./... <mask> <mask> test: <mask> go test -p 1 -v ./... <mask> <mask> benchmark: </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/Makefile
<mask> "sync" <mask> "testing" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/adapter/outbound" <mask> C "github.com/Dreamacro/clash/constant" <mask> "github.com/Dreamacro/clash/hub/executor" <mask> "github.com/Dreamacro/clash/transport/socks5" <mask> <mask> "github.com/docker/docker/api/types" <mask> "github.com/docker/docker/client" <mask> "github.com/docker/go-connections/nat" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/clash_test.go
"github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" "github.com/Dreamacro/clash/hub/executor" "github.com/Dreamacro/clash/transport/socks5"
<mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> const ( <mask> ImageShadowsocks = "mritd/shadowsocks:latest" </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" "github.com/Dreamacro/clash/hub/executor" "github.com/Dreamacro/clash/transport/socks5" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/clash_test.go
<mask> "fmt" <mask> "testing" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/adapter/outbound" <mask> C "github.com/Dreamacro/clash/constant" <mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_SnellObfsHTTP(t *testing.T) { </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/snell_test.go
"github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant"
<mask> "time" <mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_SnellObfsHTTP(t *testing.T) { <mask> cfg := &container.Config{ </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/snell_test.go
<mask> "net" <mask> "testing" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/adapter/outbound" <mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_Shadowsocks(t *testing.T) { </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/ss_test.go
"github.com/Dreamacro/clash/adapter/outbound"
<mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_Shadowsocks(t *testing.T) { <mask> cfg := &container.Config{ <mask> Image: ImageShadowsocksRust, </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/ss_test.go
<mask> "net" <mask> "testing" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/adapter/outbound" <mask> C "github.com/Dreamacro/clash/constant" <mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_Trojan(t *testing.T) { </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/trojan_test.go
"github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant"
<mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_Trojan(t *testing.T) { <mask> cfg := &container.Config{ </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/trojan_test.go
<mask> "fmt" <mask> "testing" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/adapter/outbound" <mask> C "github.com/Dreamacro/clash/constant" <mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_Vmess(t *testing.T) { </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/vmess_test.go
"github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant"
<mask> "time" <mask> <mask> "github.com/docker/docker/api/types/container" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestClash_Vmess(t *testing.T) { <mask> configPath := C.Path.Resolve("vmess.json") </s> Chore: make test linter happy </s> remove "github.com/Dreamacro/clash/adapter/outbound" C "github.com/Dreamacro/clash/constant" </s> add </s> remove "github.com/Dreamacro/clash/adapter/outbound" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff2f2b667b04b769558f4f3af2e86015f6549bc7
test/vmess_test.go
a.userKey = []byte(params[1])
<mask> params := strings.Split(a.Param, ":") <mask> if len(params) >= 2 { <mask> if userID, err := strconv.ParseUint(params[0], 10, 32); err == nil { <mask> binary.LittleEndian.PutUint32(a.uid[:], uint32(userID)) <mask> a.userKey = []byte(params[1])[:len(a.userKey)] <mask> } <mask> } <mask> <mask> if a.userKey == nil { <mask> rand.Read(a.uid[:]) </s> Fix: connectivity of ssr auth_chain_(ab) protocol (#1180) </s> remove if chunkLength <= 1500 { </s> add if chunkLength+authHeadLength <= cap(outData) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff430df8454a1662f78c4d0935bde66066eb224e
component/ssr/protocol/auth_chain_a.go
a.clientID = nil } if len(a.clientID) == 0 { a.clientID = make([]byte, 4)
<mask> defer a.mutex.Unlock() <mask> a.connectionID++ <mask> if a.connectionID > 0xFF000000 { <mask> rand.Read(a.clientID) <mask> b := make([]byte, 4) <mask> rand.Read(b) <mask> a.connectionID = binary.LittleEndian.Uint32(b) & 0xFFFFFF </s> Fix: connectivity of ssr auth_chain_(ab) protocol (#1180) </s> remove if chunkLength <= 1500 { </s> add if chunkLength+authHeadLength <= cap(outData) { </s> remove a.userKey = []byte(params[1])[:len(a.userKey)] </s> add a.userKey = []byte(params[1])
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff430df8454a1662f78c4d0935bde66066eb224e
component/ssr/protocol/auth_chain_a.go
if chunkLength+authHeadLength <= cap(outData) {
<mask> a.dec, _ = rc4.NewCipher(cipherKey) <mask> <mask> // data <mask> chunkLength, randLength := a.packedDataLen(data) <mask> if chunkLength <= 1500 { <mask> outData = outData[:authHeadLength+chunkLength] <mask> } else { <mask> newOutData := make([]byte, authHeadLength+chunkLength) <mask> copy(newOutData, outData[:authHeadLength]) <mask> outData = newOutData </s> Fix: connectivity of ssr auth_chain_(ab) protocol (#1180) </s> remove a.userKey = []byte(params[1])[:len(a.userKey)] </s> add a.userKey = []byte(params[1])
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff430df8454a1662f78c4d0935bde66066eb224e
component/ssr/protocol/auth_chain_a.go
l, err := Listen("tcp", ":10001")
<mask> <mask> func testPingPongWithSocksPort(t *testing.T, port int) { <mask> pingCh, pongCh, test := newPingPongPair() <mask> go func() { <mask> l, err := net.Listen("tcp", ":10001") <mask> if err != nil { <mask> assert.FailNow(t, err.Error()) <mask> } <mask> <mask> c, err := l.Accept() </s> Test: fix direct listen fail </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
l, err := Listen("tcp", ":10001")
<mask> test(t) <mask> } <mask> <mask> func testPingPongWithConn(t *testing.T, c net.Conn) error { <mask> l, err := net.Listen("tcp", ":10001") <mask> if err != nil { <mask> return err <mask> } <mask> defer l.Close() <mask> </s> Test: fix direct listen fail </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
l, err := ListenPacket("udp", ":10001")
<mask> return test(t) <mask> } <mask> <mask> func testPingPongWithPacketConn(t *testing.T, pc net.PacketConn) error { <mask> l, err := net.ListenPacket("udp", ":10001") <mask> if err != nil { <mask> return err <mask> } <mask> defer l.Close() <mask> </s> Test: fix direct listen fail </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
l, err := Listen("tcp", ":10001")
<mask> recvHash map[int][]byte <mask> } <mask> <mask> func testLargeDataWithConn(t *testing.T, c net.Conn) error { <mask> l, err := net.Listen("tcp", ":10001") <mask> if err != nil { <mask> return err <mask> } <mask> defer l.Close() <mask> </s> Test: fix direct listen fail </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
l, err := ListenPacket("udp", ":10001")
<mask> return test(t) <mask> } <mask> <mask> func testLargeDataWithPacketConn(t *testing.T, pc net.PacketConn) error { <mask> l, err := net.ListenPacket("udp", ":10001") <mask> if err != nil { <mask> return err <mask> } <mask> defer l.Close() <mask> </s> Test: fix direct listen fail </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
l, err := Listen("tcp", ":10001")
<mask> assert.NoError(t, testPacketConnTimeout(t, pc)) <mask> } <mask> <mask> func benchmarkProxy(b *testing.B, proxy C.ProxyAdapter) { <mask> l, err := net.Listen("tcp", ":10001") <mask> if err != nil { <mask> assert.FailNow(b, err.Error()) <mask> } <mask> <mask> go func() { </s> Test: fix direct listen fail </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
rand.Read(chunk)
<mask> }() <mask> <mask> chunkSize := int64(16 * 1024) <mask> chunk := make([]byte, chunkSize) <mask> conn, err := proxy.DialContext(context.Background(), &C.Metadata{ <mask> Host: localIP.String(), <mask> DstPort: "10001", <mask> AddrType: socks5.AtypDomainName, </s> Test: fix direct listen fail </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001") </s> remove l, err := net.Listen("tcp", ":10001") </s> add l, err := Listen("tcp", ":10001") </s> remove l, err := net.ListenPacket("udp", ":10001") </s> add l, err := ListenPacket("udp", ":10001")
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/ff56e5c5de10c70dfd8b9c674ed2e322a902baeb
test/clash_test.go
"bytes" "io/ioutil"
<mask> <mask> package main <mask> <mask> import ( <mask> "log" <mask> "os" <mask> "os/exec" <mask> "path/filepath" <mask> "strings" <mask> ) </s> Add Linux system trust support (#2) Use update-ca-certificates on Debian/Ubuntu based systems, and update-ca-trust when detected on RHEL/CentOS/Fedora.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/05189bc5fa658a2e4b90867b0575829f652453a2
truststore_linux.go
"os/exec"
<mask> "log" <mask> "os" <mask> "path/filepath" <mask> "strings" <mask> ) <mask> <mask> var ( <mask> FirefoxPath = "/usr/bin/firefox" </s> Add Linux system trust support (#2) Use update-ca-certificates on Debian/Ubuntu based systems, and update-ca-trust when detected on RHEL/CentOS/Fedora.
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/05189bc5fa658a2e4b90867b0575829f652453a2
truststore_linux.go
"strings"
<mask> "log" <mask> "os" <mask> "os/exec" <mask> "path/filepath" <mask> ) <mask> <mask> var ( <mask> FirefoxPath = "/usr/bin/firefox" <mask> FirefoxProfile = os.Getenv("HOME") + "/.mozilla/firefox/*" </s> Add Linux system trust support (#2) Use update-ca-certificates on Debian/Ubuntu based systems, and update-ca-trust when detected on RHEL/CentOS/Fedora.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/05189bc5fa658a2e4b90867b0575829f652453a2
truststore_linux.go
SystemTrustFilename string SystemTrustCommand []string
<mask> CertutilInstallHelp = `apt install libnss3-tools" or "yum install nss-tools` <mask> NSSBrowsers = "Firefox and/or Chrome/Chromium" <mask> ) <mask> <mask> func init() { <mask> _, err := os.Stat("/etc/pki/ca-trust/source/anchors/") <mask> if !os.IsNotExist(err) { </s> Add Linux system trust support (#2) Use update-ca-certificates on Debian/Ubuntu based systems, and update-ca-trust when detected on RHEL/CentOS/Fedora.
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/05189bc5fa658a2e4b90867b0575829f652453a2
truststore_linux.go
"fmt"
<mask> package main <mask> <mask> import ( <mask> "bytes" <mask> "io/ioutil" <mask> "log" <mask> "os" <mask> "os/exec" </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove cmd := CommandWithSudo("rm", SystemTrustFilename) </s> add cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename()) </s> remove cmd := CommandWithSudo("tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", m.systemTrustFilename()) </s> remove SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt" </s> remove SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt"
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/%s.pem"
<mask> ) <mask> <mask> func init() { <mask> if pathExists("/etc/pki/ca-trust/source/anchors/") { <mask> SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" <mask> SystemTrustCommand = []string{"update-ca-trust", "extract"} <mask> } else if pathExists("/usr/local/share/ca-certificates/") { <mask> SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" <mask> SystemTrustCommand = []string{"update-ca-certificates"} <mask> } else if pathExists("/etc/ca-certificates/trust-source/anchors/") { </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt" </s> remove SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt" </s> remove cmd := CommandWithSudo("rm", SystemTrustFilename) </s> add cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename()) </s> remove cmd := CommandWithSudo("tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", m.systemTrustFilename())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt"
<mask> if pathExists("/etc/pki/ca-trust/source/anchors/") { <mask> SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" <mask> SystemTrustCommand = []string{"update-ca-trust", "extract"} <mask> } else if pathExists("/usr/local/share/ca-certificates/") { <mask> SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" <mask> SystemTrustCommand = []string{"update-ca-certificates"} <mask> } else if pathExists("/etc/ca-certificates/trust-source/anchors/") { <mask> SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" <mask> SystemTrustCommand = []string{"trust", "extract-compat"} <mask> } </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" </s> add SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/%s.pem" </s> remove SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt" </s> remove cmd := CommandWithSudo("rm", SystemTrustFilename) </s> add cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename()) </s> remove cmd := CommandWithSudo("tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", m.systemTrustFilename())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt"
<mask> } else if pathExists("/usr/local/share/ca-certificates/") { <mask> SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" <mask> SystemTrustCommand = []string{"update-ca-certificates"} <mask> } else if pathExists("/etc/ca-certificates/trust-source/anchors/") { <mask> SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" <mask> SystemTrustCommand = []string{"trust", "extract-compat"} <mask> } <mask> if SystemTrustCommand != nil { <mask> _, err := exec.LookPath(SystemTrustCommand[0]) <mask> if err != nil { </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt" </s> remove SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" </s> add SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/%s.pem" </s> remove cmd := CommandWithSudo("rm", SystemTrustFilename) </s> add cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename()) </s> remove cmd := CommandWithSudo("tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", m.systemTrustFilename())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
cmd := CommandWithSudo("tee", m.systemTrustFilename())
<mask> <mask> cert, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootName)) <mask> fatalIfErr(err, "failed to read root certificate") <mask> <mask> cmd := CommandWithSudo("tee", SystemTrustFilename) <mask> cmd.Stdin = bytes.NewReader(cert) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "tee", out) <mask> <mask> cmd = CommandWithSudo(SystemTrustCommand...) </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove cmd := CommandWithSudo("rm", SystemTrustFilename) </s> add cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename()) </s> remove SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt" </s> remove SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt" </s> remove SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" </s> add SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/%s.pem"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename())
<mask> if SystemTrustCommand == nil { <mask> return false <mask> } <mask> <mask> cmd := CommandWithSudo("rm", SystemTrustFilename) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "rm", out) <mask> <mask> cmd = CommandWithSudo(SystemTrustCommand...) <mask> out, err = cmd.CombinedOutput() </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove cmd := CommandWithSudo("tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", m.systemTrustFilename()) </s> remove SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt" </s> remove SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt" </s> remove SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" </s> add SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/%s.pem"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
// We used to install under non-unique filenames. legacyFilename := fmt.Sprintf(SystemTrustFilename, "mkcert-rootCA") if pathExists(legacyFilename) { cmd := CommandWithSudo("rm", "-f", legacyFilename) out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "rm (legacy filename)", out) }
<mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "rm", out) <mask> <mask> cmd = CommandWithSudo(SystemTrustCommand...) <mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, strings.Join(SystemTrustCommand, " "), out) <mask> </s> linux: use unique per-CA names when installing certificates Fixes #52 Closes #59 </s> remove cmd := CommandWithSudo("rm", SystemTrustFilename) </s> add cmd := CommandWithSudo("rm", "-f", m.systemTrustFilename()) </s> remove cmd := CommandWithSudo("tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", m.systemTrustFilename()) </s> remove SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/etc/ca-certificates/trust-source/anchors/%s.crt" </s> remove SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> add SystemTrustFilename = "/usr/local/share/ca-certificates/%s.crt" </s> remove SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" </s> add SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/%s.pem"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0bd4ac60dab15c884632c33218147859fe5414ff
truststore_linux.go
"net/mail"
<mask> "io/ioutil" <mask> "log" <mask> "math/big" <mask> "net" <mask> "os" <mask> "os/user" <mask> "path/filepath" <mask> "regexp" <mask> "strconv" <mask> "strings" </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
cert.go
<mask> NotAfter: time.Now().AddDate(10, 0, 0), <mask> NotBefore: time.Now(), <mask> <mask> KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, <mask> ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, <mask> BasicConstraintsValid: true, <mask> } <mask> for _, h := range hosts { <mask> if ip := net.ParseIP(h); ip != nil { <mask> tpl.IPAddresses = append(tpl.IPAddresses, ip) </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
cert.go
} else if email, err := mail.ParseAddress(h); err == nil && email.Address == h { tpl.EmailAddresses = append(tpl.EmailAddresses, h)
<mask> if ip := net.ParseIP(h); ip != nil { <mask> tpl.IPAddresses = append(tpl.IPAddresses, ip) <mask> } else { <mask> tpl.DNSNames = append(tpl.DNSNames, h) <mask> } <mask> } <mask> </s> Allow email SANs for S/MIME certificates (#152) </s> remove ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, </s> add </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
cert.go
} else if len(tpl.IPAddresses) > 0 || len(tpl.DNSNames) > 0 { tpl.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth} } if len(tpl.EmailAddresses) > 0 { tpl.ExtKeyUsage = append(tpl.ExtKeyUsage, x509.ExtKeyUsageCodeSigning, x509.ExtKeyUsageEmailProtection)
<mask> } <mask> <mask> if m.client { <mask> tpl.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth} <mask> } <mask> <mask> // IIS (the main target of PKCS #12 files), only shows the deprecated <mask> // Common Name in the UI. See issue #115. <mask> if m.pkcs12 { <mask> tpl.Subject.CommonName = hosts[0] </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err) </s> remove ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, </s> add </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
cert.go
"net/mail"
<mask> "flag" <mask> "fmt" <mask> "log" <mask> "net" <mask> "os" <mask> "path/filepath" <mask> "regexp" <mask> "runtime" </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
main.go
if email, err := mail.ParseAddress(name); err == nil && email.Address == name { continue }
<mask> continue <mask> } <mask> punycode, err := idna.ToASCII(name) <mask> if err != nil { <mask> log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err) <mask> } <mask> args[i] = punycode <mask> if !hostnameRegexp.MatchString(punycode) { </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name) </s> remove ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
main.go
log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err)
<mask> continue <mask> } <mask> punycode, err := idna.ToASCII(name) <mask> if err != nil { <mask> log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) <mask> } <mask> args[i] = punycode <mask> if !hostnameRegexp.MatchString(punycode) { <mask> log.Fatalf("ERROR: %q is not a valid hostname or IP", name) <mask> } </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP", name) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name) </s> remove ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
main.go
log.Fatalf("ERROR: %q is not a valid hostname, IP, or email", name)
<mask> log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) <mask> } <mask> args[i] = punycode <mask> if !hostnameRegexp.MatchString(punycode) { <mask> log.Fatalf("ERROR: %q is not a valid hostname or IP", name) <mask> } <mask> } <mask> <mask> m.makeCert(args) <mask> } </s> Allow email SANs for S/MIME certificates (#152) </s> remove log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err) </s> add log.Fatalf("ERROR: %q is not a valid hostname, IP, or email: %s", name, err) </s> remove ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/0d4cf75db86bac9e12d8e1aab65db361ef12f6ac
main.go
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" \ -ldflags "-X main.Version=$(git describe --tags)"
<mask> go: stable <mask> <mask> script: <mask> - go run analysis.go ./... <mask> - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" <mask> - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" <mask> - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" <mask> - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" <mask> <mask> deploy: <mask> provider: releases <mask> skip_cleanup: true <mask> file_glob: true </s> Add -version flag Closes #197 Fixes #191
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1382fc8fe8bd8ad8315353b7cc30a95d5efa3969
.travis.yml
// Version is set more precisely at build time. var Version = "v1.4.0-dev"
<mask> <mask> ` <mask> <mask> func main() { <mask> log.SetFlags(0) <mask> var ( <mask> installFlag = flag.Bool("install", false, "") <mask> uninstallFlag = flag.Bool("uninstall", false, "") </s> Add -version flag Closes #197 Fixes #191 </s> remove - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" </s> add - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" \ -ldflags "-X main.Version=$(git describe --tags)"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1382fc8fe8bd8ad8315353b7cc30a95d5efa3969
main.go
versionFlag = flag.Bool("version", false, "")
<mask> certFileFlag = flag.String("cert-file", "", "") <mask> keyFileFlag = flag.String("key-file", "", "") <mask> p12FileFlag = flag.String("p12-file", "", "") <mask> ) <mask> flag.Usage = func() { <mask> fmt.Fprint(flag.CommandLine.Output(), shortUsage) <mask> fmt.Fprintln(flag.CommandLine.Output(), `For more options, run "mkcert -help".`) <mask> } <mask> flag.Parse() </s> Add -version flag Closes #197 Fixes #191 </s> remove - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" </s> add - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" \ -ldflags "-X main.Version=$(git describe --tags)"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1382fc8fe8bd8ad8315353b7cc30a95d5efa3969
main.go
if *versionFlag { fmt.Println(Version) return }
<mask> fmt.Fprint(flag.CommandLine.Output(), advancedUsage) <mask> return <mask> } <mask> if *carootFlag { <mask> if *installFlag || *uninstallFlag { <mask> log.Fatalln("ERROR: you can't set -[un]install and -CAROOT at the same time") <mask> } <mask> fmt.Println(getCAROOT()) </s> Add -version flag Closes #197 Fixes #191 </s> remove - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" </s> add - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" \ -ldflags "-X main.Version=$(git describe --tags)" - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" \ -ldflags "-X main.Version=$(git describe --tags)"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1382fc8fe8bd8ad8315353b7cc30a95d5efa3969
main.go
out, err := execKeytool(exec.Command(keytoolPath, args...))
<mask> "-file", filepath.Join(m.CAROOT, rootName), <mask> "-alias", m.caUniqueName(), <mask> } <mask> <mask> out, err := m.execKeytool(exec.Command(keytoolPath, args...)) <mask> fatalIfCmdErr(err, "keytool -importcert", out) <mask> } <mask> <mask> func (m *mkcert) uninstallJava() { <mask> args := []string{ </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...)) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out) </s> remove cmd = commandWithSudo(keytoolPath) </s> add cmd = commandWithSudo(cmd.Path) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_java.go
out, err := execKeytool(exec.Command(keytoolPath, args...))
<mask> "-alias", m.caUniqueName(), <mask> "-keystore", cacertsPath, <mask> "-storepass", storePass, <mask> } <mask> out, err := m.execKeytool(exec.Command(keytoolPath, args...)) <mask> if bytes.Contains(out, []byte("does not exist")) { <mask> return // cert didn't exist <mask> } <mask> fatalIfCmdErr(err, "keytool -delete", out) <mask> } </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...)) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out) </s> remove func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> add func execKeytool(cmd *exec.Cmd) ([]byte, error) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_java.go
func execKeytool(cmd *exec.Cmd) ([]byte, error) {
<mask> } <mask> <mask> // execKeytool will execute a "keytool" command and if needed re-execute <mask> // the command with commandWithSudo to work around file permissions. <mask> func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { <mask> out, err := cmd.CombinedOutput() <mask> if err != nil && bytes.Contains(out, []byte("java.io.FileNotFoundException")) && runtime.GOOS != "windows" { <mask> origArgs := cmd.Args[1:] <mask> cmd = commandWithSudo(keytoolPath) <mask> cmd.Args = append(cmd.Args, origArgs...) </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove cmd = commandWithSudo(keytoolPath) </s> add cmd = commandWithSudo(cmd.Path) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out) </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_java.go
cmd = commandWithSudo(cmd.Path)
<mask> func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { <mask> out, err := cmd.CombinedOutput() <mask> if err != nil && bytes.Contains(out, []byte("java.io.FileNotFoundException")) && runtime.GOOS != "windows" { <mask> origArgs := cmd.Args[1:] <mask> cmd = commandWithSudo(keytoolPath) <mask> cmd.Args = append(cmd.Args, origArgs...) <mask> cmd.Env = []string{ <mask> "JAVA_HOME=" + javaHome, <mask> } <mask> out, err = cmd.CombinedOutput() </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> add func execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...)) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_java.go
"bytes"
<mask> <mask> import ( <mask> "log" <mask> "os" <mask> "os/exec" <mask> "path/filepath" <mask> "runtime" </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out) </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out) </s> remove cmd = commandWithSudo(keytoolPath) </s> add cmd = commandWithSudo(cmd.Path) </s> remove func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> add func execKeytool(cmd *exec.Cmd) ([]byte, error) {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_nss.go
out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out)
<mask> <mask> func (m *mkcert) installNSS() bool { <mask> if m.forEachNSSProfile(func(profile string) { <mask> cmd := exec.Command(certutilPath, "-A", "-d", profile, "-t", "C,,", "-n", m.caUniqueName(), "-i", filepath.Join(m.CAROOT, rootName)) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "certutil -A", out) <mask> }) == 0 { <mask> log.Printf("ERROR: no %s security databases found", NSSBrowsers) <mask> return false <mask> } <mask> if !m.checkNSS() { </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out) </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...)) </s> remove cmd = commandWithSudo(keytoolPath) </s> add cmd = commandWithSudo(cmd.Path) </s> remove func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> add func execKeytool(cmd *exec.Cmd) ([]byte, error) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_nss.go
out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out)
<mask> if err != nil { <mask> return <mask> } <mask> cmd := exec.Command(certutilPath, "-D", "-d", profile, "-n", m.caUniqueName()) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "certutil -D", out) <mask> }) <mask> } <mask> <mask> func (m *mkcert) forEachNSSProfile(f func(profile string)) (found int) { <mask> profiles, _ := filepath.Glob(FirefoxProfile) </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out) </s> remove cmd = commandWithSudo(keytoolPath) </s> add cmd = commandWithSudo(cmd.Path) </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...)) </s> remove func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> add func execKeytool(cmd *exec.Cmd) ([]byte, error) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_nss.go
// execCertutil will execute a "certutil" command and if needed re-execute // the command with commandWithSudo to work around file permissions. func execCertutil(cmd *exec.Cmd) ([]byte, error) { out, err := cmd.CombinedOutput() if err != nil && bytes.Contains(out, []byte("SEC_ERROR_READ_ONLY")) && runtime.GOOS != "windows" { origArgs := cmd.Args[1:] cmd = commandWithSudo(cmd.Path) cmd.Args = append(cmd.Args, origArgs...) out, err = cmd.CombinedOutput() } return out, err }
<mask> }) <mask> } <mask> <mask> func (m *mkcert) forEachNSSProfile(f func(profile string)) (found int) { <mask> profiles, _ := filepath.Glob(FirefoxProfile) <mask> profiles = append(profiles, nssDBs...) <mask> for _, profile := range profiles { </s> truststore_nss: retry certtool with sudo when it fails due to permissions Based on @rfay's investigation and fix. Fixes #192 Closes #193 </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -D", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -D -d "+profile, out) </s> remove cmd = commandWithSudo(keytoolPath) </s> add cmd = commandWithSudo(cmd.Path) </s> remove func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> add func execKeytool(cmd *exec.Cmd) ([]byte, error) { </s> remove out, err := cmd.CombinedOutput() fatalIfCmdErr(err, "certutil -A", out) </s> add out, err := execCertutil(cmd) fatalIfCmdErr(err, "certutil -A -d "+profile, out) </s> remove out, err := m.execKeytool(exec.Command(keytoolPath, args...)) </s> add out, err := execKeytool(exec.Command(keytoolPath, args...))
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1b4ad6c774f5de7837f474e0141a7decf8d97f0f
truststore_nss.go
install: (cd && go get honnef.co/go/tools/cmd/staticcheck)
<mask> language: go <mask> sudo: false <mask> go: stable <mask> install: "# skip" <mask> <mask> script: <mask> - go vet <mask> - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" <mask> - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" </s> Add staticcheck to CI (#171) </s> remove fmt.Fprintf(flag.CommandLine.Output(), shortUsage) fmt.Fprintf(flag.CommandLine.Output(), advancedUsage) </s> add fmt.Fprint(flag.CommandLine.Output(), shortUsage) fmt.Fprint(flag.CommandLine.Output(), advancedUsage) </s> remove fmt.Fprintf(flag.CommandLine.Output(), shortUsage) </s> add fmt.Fprint(flag.CommandLine.Output(), shortUsage)
[ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1f0796c9266088357894ebd6570af235c36c81f6
.travis.yml
- staticcheck ./...
<mask> <mask> script: <mask> - go vet <mask> - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-linux-amd64" <mask> - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o "mkcert-$(git describe --tags)-linux-arm" <mask> - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-darwin-amd64" <mask> - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o "mkcert-$(git describe --tags)-windows-amd64.exe" <mask> </s> Add staticcheck to CI (#171) </s> remove fmt.Fprintf(flag.CommandLine.Output(), shortUsage) fmt.Fprintf(flag.CommandLine.Output(), advancedUsage) </s> add fmt.Fprint(flag.CommandLine.Output(), shortUsage) fmt.Fprint(flag.CommandLine.Output(), advancedUsage) </s> remove fmt.Fprintf(flag.CommandLine.Output(), shortUsage) </s> add fmt.Fprint(flag.CommandLine.Output(), shortUsage) </s> remove install: "# skip" </s> add install: (cd && go get honnef.co/go/tools/cmd/staticcheck)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1f0796c9266088357894ebd6570af235c36c81f6
.travis.yml
fmt.Fprint(flag.CommandLine.Output(), shortUsage)
<mask> keyFileFlag = flag.String("key-file", "", "") <mask> p12FileFlag = flag.String("p12-file", "", "") <mask> ) <mask> flag.Usage = func() { <mask> fmt.Fprintf(flag.CommandLine.Output(), shortUsage) <mask> fmt.Fprintln(flag.CommandLine.Output(), `For more options, run "mkcert -help".`) <mask> } <mask> flag.Parse() <mask> if *helpFlag { <mask> fmt.Fprintf(flag.CommandLine.Output(), shortUsage) </s> Add staticcheck to CI (#171) </s> remove fmt.Fprintf(flag.CommandLine.Output(), shortUsage) fmt.Fprintf(flag.CommandLine.Output(), advancedUsage) </s> add fmt.Fprint(flag.CommandLine.Output(), shortUsage) fmt.Fprint(flag.CommandLine.Output(), advancedUsage) </s> remove install: "# skip" </s> add install: (cd && go get honnef.co/go/tools/cmd/staticcheck)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1f0796c9266088357894ebd6570af235c36c81f6
main.go
fmt.Fprint(flag.CommandLine.Output(), shortUsage) fmt.Fprint(flag.CommandLine.Output(), advancedUsage)
<mask> fmt.Fprintln(flag.CommandLine.Output(), `For more options, run "mkcert -help".`) <mask> } <mask> flag.Parse() <mask> if *helpFlag { <mask> fmt.Fprintf(flag.CommandLine.Output(), shortUsage) <mask> fmt.Fprintf(flag.CommandLine.Output(), advancedUsage) <mask> return <mask> } <mask> if *carootFlag { <mask> if *installFlag || *uninstallFlag { <mask> log.Fatalln("ERROR: you can't set -[un]install and -CAROOT at the same time") </s> Add staticcheck to CI (#171) </s> remove fmt.Fprintf(flag.CommandLine.Output(), shortUsage) </s> add fmt.Fprint(flag.CommandLine.Output(), shortUsage) </s> remove install: "# skip" </s> add install: (cd && go get honnef.co/go/tools/cmd/staticcheck)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/1f0796c9266088357894ebd6570af235c36c81f6
main.go
if !pathExists(filepath.Join(m.CAROOT, rootKeyName)) {
<mask> } <mask> m.caCert, err = x509.ParseCertificate(certDERBlock.Bytes) <mask> fatalIfErr(err, "failed to parse the CA certificate") <mask> <mask> if _, err := os.Stat(filepath.Join(m.CAROOT, rootKeyName)); os.IsNotExist(err) { <mask> return // keyless mode, where only -install works <mask> } <mask> <mask> keyPEMBlock, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootKeyName)) <mask> fatalIfErr(err, "failed to read the CA key") </s> Cleanup path logics with pathExists and binaryExists </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) { </s> remove if _, err := os.Stat(filepath.Join(profile, "cert9.db")); err == nil { </s> add if pathExists(filepath.Join(profile, "cert9.db")) { </s> remove if _, err := os.Stat(nssDB); err == nil { </s> add if pathExists(nssDB) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
cert.go
"os/exec"
<mask> "log" <mask> "net" <mask> "net/mail" <mask> "os" <mask> "path/filepath" <mask> "regexp" <mask> "runtime" <mask> "strings" <mask> <mask> "golang.org/x/net/idna" </s> Cleanup path logics with pathExists and binaryExists </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) { </s> remove func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil } </s> add </s> remove _, err := os.Stat(filepath.Join(v, keytoolPath)) if err == nil { </s> add if pathExists(filepath.Join(v, keytoolPath)) { </s> remove _, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts")) if err == nil { </s> add if pathExists(filepath.Join(v, "lib", "security", "cacerts")) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
main.go
func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil }
<mask> if err != nil { <mask> log.Fatalf("ERROR: failed to execute \"%s\": %s\n\n%s\n", cmd, err, out) <mask> } <mask> } </s> Cleanup path logics with pathExists and binaryExists </s> remove if _, err := os.Stat(filepath.Join(m.CAROOT, rootKeyName)); os.IsNotExist(err) { </s> add if !pathExists(filepath.Join(m.CAROOT, rootKeyName)) { </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove if _, err := exec.LookPath("sudo"); err != nil { </s> add if !binaryExists("sudo") { </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) {
[ "keep", "keep", "keep", "add" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
main.go
if pathExists(filepath.Join(v, keytoolPath)) {
<mask> if v := os.Getenv("JAVA_HOME"); v != "" { <mask> hasJava = true <mask> javaHome = v <mask> <mask> _, err := os.Stat(filepath.Join(v, keytoolPath)) <mask> if err == nil { <mask> hasKeytool = true <mask> keytoolPath = filepath.Join(v, keytoolPath) <mask> } <mask> <mask> _, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts")) </s> Cleanup path logics with pathExists and binaryExists </s> remove _, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts")) if err == nil { </s> add if pathExists(filepath.Join(v, "lib", "security", "cacerts")) { </s> remove _, err = os.Stat(filepath.Join(v, "jre", "lib", "security", "cacerts")) if err == nil { </s> add if pathExists(filepath.Join(v, "jre", "lib", "security", "cacerts")) { </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") _, err = os.Stat(certutilPath) </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_java.go
if pathExists(filepath.Join(v, "lib", "security", "cacerts")) {
<mask> hasKeytool = true <mask> keytoolPath = filepath.Join(v, keytoolPath) <mask> } <mask> <mask> _, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts")) <mask> if err == nil { <mask> cacertsPath = filepath.Join(v, "lib", "security", "cacerts") <mask> } <mask> <mask> _, err = os.Stat(filepath.Join(v, "jre", "lib", "security", "cacerts")) <mask> if err == nil { </s> Cleanup path logics with pathExists and binaryExists </s> remove _, err = os.Stat(filepath.Join(v, "jre", "lib", "security", "cacerts")) if err == nil { </s> add if pathExists(filepath.Join(v, "jre", "lib", "security", "cacerts")) { </s> remove _, err := os.Stat(filepath.Join(v, keytoolPath)) if err == nil { </s> add if pathExists(filepath.Join(v, keytoolPath)) { </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") _, err = os.Stat(certutilPath) </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_java.go
if pathExists(filepath.Join(v, "jre", "lib", "security", "cacerts")) {
<mask> if err == nil { <mask> cacertsPath = filepath.Join(v, "lib", "security", "cacerts") <mask> } <mask> <mask> _, err = os.Stat(filepath.Join(v, "jre", "lib", "security", "cacerts")) <mask> if err == nil { <mask> cacertsPath = filepath.Join(v, "jre", "lib", "security", "cacerts") <mask> } <mask> } <mask> } <mask> </s> Cleanup path logics with pathExists and binaryExists </s> remove _, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts")) if err == nil { </s> add if pathExists(filepath.Join(v, "lib", "security", "cacerts")) { </s> remove _, err := os.Stat(filepath.Join(v, keytoolPath)) if err == nil { </s> add if pathExists(filepath.Join(v, keytoolPath)) { </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_java.go
if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil
<mask> } else if pathExists("/usr/share/pki/trust/anchors") { <mask> SystemTrustFilename = "/usr/share/pki/trust/anchors/%s.pem" <mask> SystemTrustCommand = []string{"update-ca-certificates"} <mask> } <mask> if SystemTrustCommand != nil { <mask> _, err := exec.LookPath(SystemTrustCommand[0]) <mask> if err != nil { <mask> SystemTrustCommand = nil <mask> } <mask> } <mask> } <mask> <mask> func pathExists(path string) bool { <mask> _, err := os.Stat(path) </s> Cleanup path logics with pathExists and binaryExists </s> remove func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil } </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) { </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_linux.go
<mask> } <mask> } <mask> } <mask> <mask> func pathExists(path string) bool { <mask> _, err := os.Stat(path) <mask> return err == nil <mask> } <mask> <mask> func binaryExists(name string) bool { <mask> _, err := exec.LookPath(name) <mask> return err == nil <mask> } <mask> <mask> func (m *mkcert) systemTrustFilename() string { <mask> return fmt.Sprintf(SystemTrustFilename, strings.Replace(m.caUniqueName(), " ", "_", -1)) <mask> } <mask> <mask> func (m *mkcert) installPlatform() bool { </s> Cleanup path logics with pathExists and binaryExists </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove if _, err := os.Stat(nssDB); err == nil { </s> add if pathExists(nssDB) { </s> remove if _, err := exec.LookPath("sudo"); err != nil { </s> add if !binaryExists("sudo") {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_linux.go
if !binaryExists("sudo") {
<mask> return true <mask> } <mask> <mask> func CommandWithSudo(cmd ...string) *exec.Cmd { <mask> if _, err := exec.LookPath("sudo"); err != nil { <mask> return exec.Command(cmd[0], cmd[1:]...) <mask> } <mask> return exec.Command("sudo", append([]string{"--"}, cmd...)...) <mask> } </s> Cleanup path logics with pathExists and binaryExists </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove _, err := os.Stat(filepath.Join(v, keytoolPath)) if err == nil { </s> add if pathExists(filepath.Join(v, keytoolPath)) { </s> remove func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil } </s> add </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_linux.go
hasNSS = hasNSS || pathExists(path)
<mask> "/Applications/Firefox Developer Edition.app", <mask> "/Applications/Firefox Nightly.app", <mask> "C:\\Program Files\\Mozilla Firefox", <mask> } { <mask> _, err := os.Stat(path) <mask> hasNSS = hasNSS || err == nil <mask> } <mask> <mask> switch runtime.GOOS { <mask> case "darwin": <mask> var err error </s> Cleanup path logics with pathExists and binaryExists </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") _, err = os.Stat(certutilPath) </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove if _, err := os.Stat(filepath.Join(profile, "cert9.db")); err == nil { </s> add if pathExists(filepath.Join(profile, "cert9.db")) { </s> remove hasCertutil = err == nil </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath)
<mask> } <mask> <mask> switch runtime.GOOS { <mask> case "darwin": <mask> var err error <mask> certutilPath, err = exec.LookPath("certutil") <mask> if err != nil { <mask> var out []byte <mask> out, err = exec.Command("brew", "--prefix", "nss").Output() <mask> if err != nil { <mask> return <mask> } <mask> certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") <mask> _, err = os.Stat(certutilPath) <mask> } <mask> hasCertutil = err == nil </s> Cleanup path logics with pathExists and binaryExists </s> remove certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") _, err = os.Stat(certutilPath) </s> add </s> remove hasCertutil = err == nil </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove _, err := os.Stat(path) hasNSS = hasNSS || err == nil </s> add hasNSS = hasNSS || pathExists(path) </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
<mask> out, err = exec.Command("brew", "--prefix", "nss").Output() <mask> if err != nil { <mask> return <mask> } <mask> certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") <mask> _, err = os.Stat(certutilPath) <mask> } <mask> hasCertutil = err == nil <mask> <mask> case "linux": <mask> var err error </s> Cleanup path logics with pathExists and binaryExists </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove hasCertutil = err == nil </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove _, err := os.Stat(path) hasNSS = hasNSS || err == nil </s> add hasNSS = hasNSS || pathExists(path) </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
<mask> } <mask> certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") <mask> _, err = os.Stat(certutilPath) <mask> } <mask> hasCertutil = err == nil <mask> <mask> case "linux": <mask> var err error <mask> certutilPath, err = exec.LookPath("certutil") <mask> hasCertutil = err == nil </s> Cleanup path logics with pathExists and binaryExists </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") _, err = os.Stat(certutilPath) </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove _, err := os.Stat(path) hasNSS = hasNSS || err == nil </s> add hasNSS = hasNSS || pathExists(path) </s> remove _, err = os.Stat(filepath.Join(v, "lib", "security", "cacerts")) if err == nil { </s> add if pathExists(filepath.Join(v, "lib", "security", "cacerts")) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") }
<mask> } <mask> hasCertutil = err == nil <mask> <mask> case "linux": <mask> var err error <mask> certutilPath, err = exec.LookPath("certutil") <mask> hasCertutil = err == nil <mask> } <mask> } <mask> <mask> func (m *mkcert) checkNSS() bool { <mask> if !hasCertutil { </s> Cleanup path logics with pathExists and binaryExists </s> remove hasCertutil = err == nil </s> add </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath) </s> remove certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") _, err = os.Stat(certutilPath) </s> add </s> remove func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil } </s> add </s> remove if _, err := os.Stat(nssDB); err == nil { </s> add if pathExists(nssDB) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
if pathExists(nssDB) {
<mask> } <mask> <mask> func (m *mkcert) forEachNSSProfile(f func(profile string)) (found int) { <mask> profiles, _ := filepath.Glob(FirefoxProfile) <mask> if _, err := os.Stat(nssDB); err == nil { <mask> profiles = append(profiles, nssDB) <mask> } <mask> if len(profiles) == 0 { <mask> return <mask> } </s> Cleanup path logics with pathExists and binaryExists </s> remove var err error certutilPath, err = exec.LookPath("certutil") hasCertutil = err == nil </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } </s> remove func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil } </s> add </s> remove if _, err := os.Stat(filepath.Join(profile, "cert9.db")); err == nil { </s> add if pathExists(filepath.Join(profile, "cert9.db")) { </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) { </s> remove var err error certutilPath, err = exec.LookPath("certutil") if err != nil { var out []byte out, err = exec.Command("brew", "--prefix", "nss").Output() if err != nil { return </s> add if hasCertutil = binaryExists("certutil"); hasCertutil { certutilPath, _ = exec.LookPath("certutil") } else { out, err := exec.Command("brew", "--prefix", "nss").Output() if err == nil { certutilPath = filepath.Join(strings.TrimSpace(string(out)), "bin", "certutil") hasCertutil = pathExists(certutilPath)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
if pathExists(filepath.Join(profile, "cert9.db")) {
<mask> for _, profile := range profiles { <mask> if stat, err := os.Stat(profile); err != nil || !stat.IsDir() { <mask> continue <mask> } <mask> if _, err := os.Stat(filepath.Join(profile, "cert9.db")); err == nil { <mask> f("sql:" + profile) <mask> found++ <mask> continue <mask> } <mask> if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> Cleanup path logics with pathExists and binaryExists </s> remove continue } if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { </s> add } else if pathExists(filepath.Join(profile, "cert8.db")) { </s> remove if _, err := os.Stat(nssDB); err == nil { </s> add if pathExists(nssDB) { </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove _, err := os.Stat(filepath.Join(v, keytoolPath)) if err == nil { </s> add if pathExists(filepath.Join(v, keytoolPath)) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
} else if pathExists(filepath.Join(profile, "cert8.db")) {
<mask> } <mask> if _, err := os.Stat(filepath.Join(profile, "cert9.db")); err == nil { <mask> f("sql:" + profile) <mask> found++ <mask> continue <mask> } <mask> if _, err := os.Stat(filepath.Join(profile, "cert8.db")); err == nil { <mask> f("dbm:" + profile) <mask> found++ <mask> } <mask> } <mask> return </s> Cleanup path logics with pathExists and binaryExists </s> remove if _, err := os.Stat(filepath.Join(profile, "cert9.db")); err == nil { </s> add if pathExists(filepath.Join(profile, "cert9.db")) { </s> remove if _, err := os.Stat(nssDB); err == nil { </s> add if pathExists(nssDB) { </s> remove if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> add if SystemTrustCommand != nil && !binaryExists(SystemTrustCommand[0]) { SystemTrustCommand = nil </s> remove func pathExists(path string) bool { _, err := os.Stat(path) return err == nil } func binaryExists(name string) bool { _, err := exec.LookPath(name) return err == nil } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/245b2732c8b3f092c06ec039077782add10e094f
truststore_nss.go
<mask> } <mask> } <mask> <mask> func (m *mkcert) uninstall() { <mask> m.uninstallPlatform() <mask> if hasNSS { <mask> if hasCertutil { <mask> m.uninstallNSS() <mask> } else { <mask> log.Print("") </s> Polish Linux system store support </s> remove return </s> add } else { _, err = os.Stat("/usr/local/share/ca-certificates/") if !os.IsNotExist(err) { SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" SystemTrustCommand = []string{"update-ca-certificates"} } </s> remove _, err = os.Stat("/usr/local/share/ca-certificates/") if !os.IsNotExist(err) { SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" SystemTrustCommand = []string{"update-ca-certificates"} </s> add if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
main.go
func (m *mkcert) installPlatform() bool {
<mask> </dict> <mask> </array> <mask> `) <mask> <mask> func (m *mkcert) installPlatform() { <mask> cmd := exec.Command("sudo", "security", "add-trusted-cert", "-d", "-k", "/Library/Keychains/System.keychain", filepath.Join(m.CAROOT, rootName)) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "security add-trusted-cert", out) <mask> <mask> // Make trustSettings explicit, as older Go does not know the defaults. </s> Polish Linux system store support </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool { </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_darwin.go
return true
<mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "security trust-settings-import", out) <mask> } <mask> <mask> func (m *mkcert) uninstallPlatform() bool { <mask> cmd := exec.Command("sudo", "security", "remove-trusted-cert", "-d", filepath.Join(m.CAROOT, rootName)) <mask> out, err := cmd.CombinedOutput() </s> Polish Linux system store support </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool { </s> remove func (m *mkcert) installPlatform() { </s> add func (m *mkcert) installPlatform() bool { </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_darwin.go
func (m *mkcert) uninstallPlatform() bool {
<mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "security trust-settings-import", out) <mask> } <mask> <mask> func (m *mkcert) uninstallPlatform() { <mask> cmd := exec.Command("sudo", "security", "remove-trusted-cert", "-d", filepath.Join(m.CAROOT, rootName)) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "security remove-trusted-cert", out) <mask> } </s> Polish Linux system store support </s> remove func (m *mkcert) installPlatform() { </s> add func (m *mkcert) installPlatform() bool { </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_darwin.go
return true
<mask> func (m *mkcert) uninstallPlatform() bool { <mask> cmd := exec.Command("sudo", "security", "remove-trusted-cert", "-d", filepath.Join(m.CAROOT, rootName)) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "security remove-trusted-cert", out) <mask> } </s> Polish Linux system store support </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool { </s> remove func (m *mkcert) installPlatform() { </s> add func (m *mkcert) installPlatform() bool { </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...)
[ "keep", "keep", "keep", "add", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_darwin.go
} else { _, err = os.Stat("/usr/local/share/ca-certificates/") if !os.IsNotExist(err) { SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" SystemTrustCommand = []string{"update-ca-certificates"} }
<mask> _, err := os.Stat("/etc/pki/ca-trust/source/anchors/") <mask> if !os.IsNotExist(err) { <mask> SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" <mask> SystemTrustCommand = []string{"update-ca-trust", "extract"} <mask> return <mask> } <mask> <mask> _, err = os.Stat("/usr/local/share/ca-certificates/") <mask> if !os.IsNotExist(err) { <mask> SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" </s> Polish Linux system store support </s> remove _, err = os.Stat("/usr/local/share/ca-certificates/") if !os.IsNotExist(err) { SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" SystemTrustCommand = []string{"update-ca-certificates"} </s> add if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil }
<mask> SystemTrustFilename = "/etc/pki/ca-trust/source/anchors/mkcert-rootCA.pem" <mask> SystemTrustCommand = []string{"update-ca-trust", "extract"} <mask> return <mask> } <mask> <mask> _, err = os.Stat("/usr/local/share/ca-certificates/") <mask> if !os.IsNotExist(err) { <mask> SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" <mask> SystemTrustCommand = []string{"update-ca-certificates"} <mask> } <mask> } <mask> <mask> func (m *mkcert) installPlatform() { <mask> if SystemTrustCommand == nil { </s> Polish Linux system store support </s> remove return </s> add } else { _, err = os.Stat("/usr/local/share/ca-certificates/") if !os.IsNotExist(err) { SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" SystemTrustCommand = []string{"update-ca-certificates"} } </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove m.uninstallPlatform() </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
cmd := CommandWithSudo("tee", SystemTrustFilename)
<mask> <mask> cert, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootName)) <mask> fatalIfErr(err, "failed to read root certificate") <mask> <mask> cmd := exec.Command("sudo", "tee", SystemTrustFilename) <mask> cmd.Stdin = bytes.NewReader(cert) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "tee", out) <mask> <mask> cmd = exec.Command("sudo", SystemTrustCommand...) </s> Polish Linux system store support </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
cmd = CommandWithSudo(SystemTrustCommand...)
<mask> cmd.Stdin = bytes.NewReader(cert) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "tee", out) <mask> <mask> cmd = exec.Command("sudo", SystemTrustCommand...) <mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, strings.Join(SystemTrustCommand, " "), out) <mask> } <mask> <mask> func (m *mkcert) uninstallPlatform() { </s> Polish Linux system store support </s> remove cmd := exec.Command("sudo", "tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", SystemTrustFilename) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
return true
<mask> <mask> cmd = CommandWithSudo(SystemTrustCommand...) <mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, strings.Join(SystemTrustCommand, " "), out) <mask> } <mask> <mask> func (m *mkcert) uninstallPlatform() bool { <mask> if SystemTrustCommand == nil { <mask> return false </s> Polish Linux system store support </s> remove _, err = os.Stat("/usr/local/share/ca-certificates/") if !os.IsNotExist(err) { SystemTrustFilename = "/usr/local/share/ca-certificates/mkcert-rootCA.crt" SystemTrustCommand = []string{"update-ca-certificates"} </s> add if SystemTrustCommand != nil { _, err := exec.LookPath(SystemTrustCommand[0]) if err != nil { SystemTrustCommand = nil } </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
cmd = CommandWithSudo(SystemTrustCommand...)
<mask> cmd := exec.Command("sudo", "rm", SystemTrustFilename) <mask> out, err := cmd.CombinedOutput() <mask> fatalIfCmdErr(err, "rm", out) <mask> <mask> cmd = exec.Command("sudo", SystemTrustCommand...) <mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, strings.Join(SystemTrustCommand, " "), out) <mask> } </s> Polish Linux system store support </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd := exec.Command("sudo", "tee", SystemTrustFilename) </s> add cmd := CommandWithSudo("tee", SystemTrustFilename) </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
return true } func CommandWithSudo(cmd ...string) *exec.Cmd { if _, err := exec.LookPath("sudo"); err != nil { return exec.Command(cmd[0], cmd[1:]...) } return exec.Command("sudo", append([]string{"--"}, cmd...)...)
<mask> cmd = CommandWithSudo(SystemTrustCommand...) <mask> out, err = cmd.CombinedOutput() <mask> fatalIfCmdErr(err, strings.Join(SystemTrustCommand, " "), out) <mask> } </s> Polish Linux system store support </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove cmd = exec.Command("sudo", SystemTrustCommand...) </s> add cmd = CommandWithSudo(SystemTrustCommand...) </s> remove func (m *mkcert) uninstallPlatform() { </s> add func (m *mkcert) uninstallPlatform() bool {
[ "keep", "keep", "add", "keep" ]
https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e
truststore_linux.go
"strings"
<mask> "regexp" <mask> "runtime" <mask> <mask> "golang.org/x/net/idna" <mask> ) <mask> <mask> const shortUsage = `Usage of mkcert: </s> Add the TRUST_STORES environment variable Fixes #95
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/592400aab064e9c4e2bd9975bfe56343804aec17
main.go
$TRUST_STORES (environment variable) A comma-separated list of trust stores to install the local root CA into. Options are: "system", "java" and "nss" (includes Firefox). Autodetected by default.
<mask> maintaining multiple local CAs in parallel.) <mask> <mask> ` <mask> <mask> func main() { <mask> log.SetFlags(0) </s> Add the TRUST_STORES environment variable Fixes #95
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/FiloSottile/mkcert/commit/592400aab064e9c4e2bd9975bfe56343804aec17
main.go