Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: registry insecure #58

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions go/pkg/binding/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ func RemoteNew(root string) (Handle, error) {
return result, nil
}

func (h Handle) RemoteLoad(imageRef, username, password string) ([]string, error) {
func (h Handle) RemoteLoad(imageRef, username, password string, insecure bool) ([]string, error) {
result := new(Handle)
imageRefStr := NewString(imageRef)
defer imageRefStr.Free()
Expand All @@ -743,7 +743,14 @@ func (h Handle) RemoteLoad(imageRef, username, password string) ([]string, error
passwordStr := NewString(password)
defer passwordStr.Free()

if err := handleError(C.veinmind_RemoteLoad(result.Ptr(), h.ID(), imageRefStr.ID(), usernameStr.ID(), passwordStr.ID())); err != nil {
insecureVal := func() int32 {
if insecure {
return 1
}
return 0
}()

if err := handleError(C.veinmind_RemoteLoad(result.Ptr(), h.ID(), imageRefStr.ID(), usernameStr.ID(), passwordStr.ID(), C.int(insecureVal))); err != nil {
return nil, err
}
defer result.Free()
Expand Down
7 changes: 7 additions & 0 deletions go/remote/option.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package remote

type loadOptions struct {
insecure bool
username string
password string
}
Expand All @@ -15,3 +16,9 @@ func WithAuth(username, password string) LoadOption {
o.password = password
}
}

func WithInsecure() LoadOption {
return func(o *loadOptions) {
o.insecure = true
}
}
2 changes: 1 addition & 1 deletion go/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (t *Runtime) Load(imageRef string, opts ...LoadOption) ([]string, error) {
for _, o := range opts {
o(options)
}
return t.runtime.RemoteLoad(imageRef, options.username, options.password)
return t.runtime.RemoteLoad(imageRef, options.username, options.password, options.insecure)
}

func (t *Runtime) Close() error {
Expand Down
9 changes: 5 additions & 4 deletions python3/veinmind/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ def open_image_by_id(self, image_id):
_load = binding.lookup(
b"veinmind_RemoteLoad", b"VEINMIND_1.4")

def load(self, image_ref,username,password):
def load(self, image_ref,username,password,insecure):
with binding.Handle() as handle:
with binding.new_str(image_ref) as hstr:
with binding.new_str(username) as ustr:
with binding.new_str(password) as pstr:
binding.handle_error(Remote._load(
handle.ptr(), self.__handle__().val(), hstr.val(),ustr.val(),pstr.val()))
return handle.str_list()
with binding.new_str(insecure) as iptr:
binding.handle_error(Remote._load(
handle.ptr(), self.__handle__().val(), hstr.val(),ustr.val(),pstr.val(),iptr.val()))
return handle.str_list()


class Layer(filesystem.FileSystem):
Expand Down