Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
refined
Browse files Browse the repository at this point in the history
Signed-off-by: wangxiaoxuan273 <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Apr 18, 2023
1 parent 9becb4c commit 0897940
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 4 additions & 3 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@ func Credential(store Store) func(context.Context, string) (auth.Credential, err
// will be added under the key "https://index.docker.io/v1/"
func getLoginRegistry(hostname string) string {
if hostname == "docker.io" {
return "https://index.docker.io/v1/" // Login用的
return "https://index.docker.io/v1/"
}
return hostname
}

// The behavior
// It is expected that the traffic targetting "registry-1.docker.io"
// will be redirected to "https://index.docker.io/v1/"
func getTargetRegistry(target string) string {
if target == "registry-1.docker.io" {
return "https://index.docker.io/v1/" // Credential用的
return "https://index.docker.io/v1/"
}
return target
}
5 changes: 0 additions & 5 deletions registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,6 @@ func TestCredential(t *testing.T) {
registry: "localhost:2333",
wantCredential: auth.Credential{Username: "test_user", Password: "test_word"},
},
{
name: "get credentials for docker.io",
registry: "docker.io",
wantCredential: auth.Credential{Username: "user", Password: "word"},
},
{
name: "get credentials for registry-1.docker.io",
registry: "registry-1.docker.io",
Expand Down

0 comments on commit 0897940

Please sign in to comment.