func (api *NameAPI) Publish(ctx context.Context, p coreiface.Path, opts ...caopts.NamePublishOption) (coreiface.Dms3NsEntry, error) {
	options, err := caopts.NamePublishOptions(opts...)
	if err != nil {
		return nil, err
	}
	n := api.node

	if !n.OnlineMode() {
		err := n.SetupOfflineRouting()
		if err != nil {
			return nil, err
		}
	}

	if n.Mounts.Dms3Ns != nil && n.Mounts.Dms3Ns.IsActive() {
		return nil, errors.New("cannot manually publish while DMS3NS is mounted")
	}

	pth, err := ipath.ParsePath(p.String())
	if err != nil {
		return nil, err
	}

	k, err := keylookup(n, options.Key)
	if err != nil {
		return nil, err
	}

	eol := time.Now().Add(options.ValidTime)
	err = n.Namesys.PublishWithEOL(ctx, k, pth, eol)
	if err != nil {
		return nil, err
	}

	pid, err := peer.IDFromPrivateKey(k)
	if err != nil {
		return nil, err
	}

	return &dms3nsEntry{
		name:  pid.Pretty(),
		value: p,
	}, nil
}
// Publish announces new DMS3NS name and returns the new DMS3NS entry.
Publish announces new DMS3NS name and returns the new DMS3NS entry.
// Publish announces new DMS3NS name and returns the new DMS3NS entry .
func (api *NameAPI) Publish(ctx context.Context, p coreiface.Path, opts ...caopts.NamePublishOption) (coreiface.Dms3NsEntry, error) {
	options, err := caopts.NamePublishOptions(opts...)
	if err != nil {
		return nil, err
	}
	n := api.node
	if !n.OnlineMode() {
		err := n.SetupOfflineRouting()
		if err != nil {
			return nil, err
		}
	}
	if n.Mounts.Dms3Ns != nil && n.Mounts.Dms3Ns.IsActive() {
		return nil, errors.New("cannot manually publish while DMS3NS is mounted")
	}
	pth, err := ipath.ParsePath(p.String())
	if err != nil {
		return nil, err
	}
	k, err := keylookup(n, options.Key)
	if err != nil {
		return nil, err
	}
	eol := time.Now().Add(options.ValidTime)
	err = n.Namesys.PublishWithEOL(ctx, k, pth, eol)
	if err != nil {
		return nil, err
	}
	pid, err := peer.IDFromPrivateKey(k)
	if err != nil {
		return nil, err
	}
	return &dms3nsEntry{
		name:  pid.Pretty(),
		value: p,
	}, nil
}
func ( api * NameAPI ) Publish ( ctx context . Context , p coreiface . Path , opts ... caopts . NamePublishOption ) ( coreiface . Dms3NsEntry , error ) { options , err := caopts . NamePublishOptions ( opts ... ) if err != nil { return nil , err } n := api . node if ! n . OnlineMode ( ) { err := n . SetupOfflineRouting ( ) if err != nil { return nil , err } } if n . Mounts . Dms3Ns != nil && n . Mounts . Dms3Ns . IsActive ( ) { return nil , errors . New ( " " ) } pth , err := ipath . ParsePath ( p . String ( ) ) if err != nil { return nil , err } k , err := keylookup ( n , options . Key ) if err != nil { return nil , err } eol := time . Now ( ) . Add ( options . ValidTime ) err = n . Namesys . PublishWithEOL ( ctx , k , pth , eol ) if err != nil { return nil , err } pid , err := peer . IDFromPrivateKey ( k ) if err != nil { return nil , err } return & dms3nsEntry { name : pid . Pretty ( ) , value : p , } , nil }
Publish announces new DMS3NS name and returns the new DMS3NS entry.
Publish announces new DMS3NS name and returns the new DMS3NS entry .