func (t *Target) ToV2() *v2acl.Target {
	if t == nil {
		return nil
	}
	target := new(v2acl.Target)
	target.SetRole(t.role.ToV2())
	target.SetKeys(t.keys)
	return target
}
ToV2 converts Target to v2 acl.EACLRecord.Target message.

Nil Target converts to nil.
package eacl
import (
	"crypto/ecdsa"
	v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
	crypto "github.com/nspcc-dev/neofs-crypto"
)
type Target struct {
	role Role
	keys [][]byte
}
func ecdsaKeysToPtrs(keys []ecdsa.PublicKey) []*ecdsa.PublicKey {
	keysPtr := make([]*ecdsa.PublicKey, len(keys))
	for i := range keys {
		keysPtr[i] = &keys[i]
	}
	return keysPtr
}
func (t *Target) SetKeys(keys ...ecdsa.PublicKey) {
	SetTargetECDSAKeys(t, ecdsaKeysToPtrs(keys)...)
}
func (t *Target) Keys() []ecdsa.PublicKey {
	keysPtr := TargetECDSAKeys(t)
	keys := make([]ecdsa.PublicKey, 0, len(keysPtr))
	for i := range keysPtr {
		if keysPtr[i] != nil {
			keys = append(keys, *keysPtr[i])
		}
	}
	return keys
}
func (t *Target) BinaryKeys() [][]byte {
	return t.keys
}
func (t *Target) SetBinaryKeys(keys [][]byte) {
	t.keys = keys
}
func SetTargetECDSAKeys(t *Target, keys ...*ecdsa.PublicKey) {
	binKeys := t.BinaryKeys()
	ln := len(keys)
	if cap(binKeys) >= ln {
		binKeys = binKeys[:0]
	} else {
		binKeys = make([][]byte, 0, ln)
	}
	for i := 0; i < ln; i++ {
		binKeys = append(binKeys, crypto.MarshalPublicKey(keys[i]))
	}
	t.SetBinaryKeys(binKeys)
}
func TargetECDSAKeys(t *Target) []*ecdsa.PublicKey {
	binKeys := t.BinaryKeys()
	ln := len(binKeys)
	keys := make([]*ecdsa.PublicKey, ln)
	for i := 0; i < ln; i++ {
		keys[i] = crypto.UnmarshalPublicKey(binKeys[i])
	}
	return keys
}
func (t *Target) SetRole(r Role) {
	t.role = r
}
func (t Target) Role() Role {
	return t.role
}