func (is *IdentityServer) Add(ctx context.Context, ids ttnpb.GatewayIdentifiers, key string) {
	uid := unique.ID(ctx, ids)
	is.gateways[uid] = &ttnpb.Gateway{
		Ids: &ids,
	}
	if key != "" {
		is.gateways[uid].RequireAuthenticatedConnection = true
		is.gatewayAuths[uid] = []string{fmt.Sprintf("Bearer %v", key)}
	}
}
Add adds a new gateway.
package mock
import (
	"context"
	"fmt"
	"net"
	"go.thethings.network/lorawan-stack/v3/pkg/errors"
	"go.thethings.network/lorawan-stack/v3/pkg/rpcserver"
	"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
	"go.thethings.network/lorawan-stack/v3/pkg/unique"
	"google.golang.org/grpc/metadata"
)
type IdentityServer struct {
	ttnpb.GatewayRegistryServer
	ttnpb.GatewayAccessServer
	gateways     map[string]*ttnpb.Gateway
	gatewayAuths map[string][]string
}
func NewIS(ctx context.Context) (*IdentityServer, string) {
	is := &IdentityServer{
		gateways:     make(map[string]*ttnpb.Gateway),
		gatewayAuths: make(map[string][]string),
	}
	srv := rpcserver.New(ctx)
	ttnpb.RegisterGatewayRegistryServer(srv.Server, is)
	ttnpb.RegisterGatewayAccessServer(srv.Server, is)
	lis, err := net.Listen("tcp", ":0")
	if err != nil {
		panic(err)
	}
	go srv.Serve(lis)
	return is, lis.Addr().String()
}