func (p *Platform) GetDeploymentPayload(codepath string, replacer replacer.Func) ([]byte, error) {
	payload := bytes.NewBuffer(nil)
	gw, err := gzip.NewWriterLevel(payload, gzipCompressionLevel)
	if err != nil {
		return nil, err
	}
	tw := tar.NewWriter(gw)
	path, raw := replacer("connection.json", "connection.json")
	if err := WriteBytesToPackage(raw, path, tw); err != nil {
		return nil, fmt.Errorf("error writing connection.json to tar: %s", err)
	}
	if err != nil {
		return nil, fmt.Errorf("error writing connection.json to tar: %s", err)
	}
	err = tw.Close()
	if err == nil {
		err = gw.Close()
	}
	if err != nil {
		return nil, errors.Wrapf(err, "failed to create tar for chaincode")
	}
	return payload.Bytes(), nil
}
GetDeploymentPayload creates a gzip compressed tape archive that contains the
required assets to build and run go chaincode.

NOTE: this is only used at the _client_ side by the peer CLI.
package external
import (
	"archive/tar"
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"os"
	"regexp"
	"time"
	"github.com/pkg/errors"
	"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fabric/packager/replacer"
)
const c_ISDIR = 040000
var gzipCompressionLevel = gzip.DefaultCompression
type Platform struct{}
func (p *Platform) Name() string {
	return "EXTERNAL"
}
func (p *Platform) ValidatePath(rawPath string) error {
	return nil
}
func (p *Platform) NormalizePath(rawPath string) (string, error) {
	return rawPath, nil
}
func (p *Platform) ValidateCodePackage(code []byte) error {
	is := bytes.NewReader(code)
	gr, err := gzip.NewReader(is)
	if err != nil {
		return fmt.Errorf("failure opening codepackage gzip stream: %s", err)
	}
	re := regexp.MustCompile(`^(src|META-INF)/`)
	tr := tar.NewReader(gr)
	for {
		header, err := tr.Next()
		if err == io.EOF {
			break
		}
		if err != nil {
			return err
		}
		if !re.MatchString(header.Name) {
			return fmt.Errorf("illegal file name in payload: %s", header.Name)
		}
		mode := header.FileInfo().Mode()
		if mode&^(os.ModeDir|0777) != 0 {
			return fmt.Errorf("illegal file mode in payload: %s", header.Name)
		}
	}
	return nil
}