func (c *Channel) Name() string {
	return c.name
}
Name returns the channel name.
package channel
import (
	"encoding/pem"
	"regexp"
	"strings"
	"github.com/pkg/errors"
	"github.com/hyperledger/fabric-sdk-go/api/apiconfig"
	fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient"
	"github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/msp"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/orderer"
	"github.com/hyperledger/fabric-sdk-go/pkg/logging"
	"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
	pb "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/peer"
	"github.com/hyperledger/fabric-sdk-go/internal/github.com/tjfoc/gmsm/sm2"
)
var logger = logging.NewLogger("fabric_sdk_go")
type Channel struct {
	name          string  
	peers         map[string]fab.Peer
	orderers      map[string]fab.Orderer
	clientContext fab.Context
	primaryPeer   fab.Peer
	mspManager    msp.MSPManager
	anchorPeers   []*fab.OrgAnchorPeer
	initialized   bool
}
func New(ctx fab.Context, cfg fab.ChannelCfg) (*Channel, error) {
	if ctx == nil {
		return nil, errors.Errorf("client is required")
	}
	p := make(map[string]fab.Peer)
	o := make(map[string]fab.Orderer)
	c := Channel{
		name:          cfg.Name(),
		peers:         p,
		orderers:      o,
		clientContext: ctx,
	}
	mspManager := msp.NewMSPManager()
	if len(cfg.Msps()) > 0 {
		msps, err := loadMSPs(cfg.Msps(), ctx.CryptoSuite())
		if err != nil {
			return nil, errors.WithMessage(err, "load MSPs from config failed")
		}
		if err := mspManager.Setup(msps); err != nil {
			return nil, errors.WithMessage(err, "MSPManager Setup failed")
		}
		for _, msp := range msps {
			for _, cert := range msp.GetTLSRootCerts() {
				addCertsToConfig(ctx.Config(), cert)
			}
			for _, cert := range msp.GetTLSIntermediateCerts() {
				addCertsToConfig(ctx.Config(), cert)
			}
		}
	}
	c.mspManager = mspManager
	c.anchorPeers = cfg.AnchorPeers()
	for _, name := range cfg.Orderers() {
		oCfg, err := getOrdererConfig(ctx.Config(), name)
		if err != nil {
			return nil, errors.Errorf("failed to retrieve orderer config...: %s", err)
		}
		var o *orderer.Orderer
		if oCfg == nil {
			o, err = orderer.New(ctx.Config(), orderer.WithURL(resolveOrdererURL(name)), orderer.WithServerName(resolveOrdererAddress(name)))
		} else {
			o, err = orderer.New(ctx.Config(), orderer.FromOrdererConfig(oCfg))
		}
		if err != nil {
			return nil, errors.WithMessage(err, "failed to create new orderer from config")
		}
		c.orderers[o.URL()] = o
	}
	logger.Debugf("Constructed channel instance for channel %s: %v", c.name, c)
	return &c, nil
}