diff --git a/go/pkg/binding/functions.go b/go/pkg/binding/functions.go index 697a5ae..968397f 100644 --- a/go/pkg/binding/functions.go +++ b/go/pkg/binding/functions.go @@ -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() @@ -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() diff --git a/go/remote/option.go b/go/remote/option.go index cf763a4..4aa1ebc 100644 --- a/go/remote/option.go +++ b/go/remote/option.go @@ -1,6 +1,7 @@ package remote type loadOptions struct { + insecure bool username string password string } @@ -15,3 +16,9 @@ func WithAuth(username, password string) LoadOption { o.password = password } } + +func WithInsecure() LoadOption { + return func(o *loadOptions) { + o.insecure = true + } +} diff --git a/go/remote/remote.go b/go/remote/remote.go index 1839f14..2828e02 100644 --- a/go/remote/remote.go +++ b/go/remote/remote.go @@ -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 { diff --git a/python3/veinmind/remote.py b/python3/veinmind/remote.py index afbd4a4..6de4014 100644 --- a/python3/veinmind/remote.py +++ b/python3/veinmind/remote.py @@ -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):