func NewBranch(cfg map[string]interface{}, cert *tls.Certificate) (*Branch, error) {
	var err error
	var b *Branch
	if err = config.CheckBranchExportConfig(cfg); err == nil {
		addr := fmt.Sprintf("%v:%v", fileutil.ConfStr(cfg, config.RPCHost),
			fileutil.ConfStr(cfg, config.RPCPort))
		rn := node.NewNode(addr, fileutil.ConfStr(cfg, config.BranchName),
			fileutil.ConfStr(cfg, config.BranchSecret), cert, nil)
		if err = rn.Start(cert); err == nil {
			var rootPath string
			if rootPath, err = filepath.Abs(fileutil.ConfStr(cfg, config.LocalFolder)); err == nil {
				b = &Branch{rootPath, rn, fileutil.ConfBool(cfg, config.EnableReadOnly)}
				rn.DataHandler = b.requestHandler
			}
		}
	}
	return b, err
}
/*
NewBranch returns a new exported branch.
package rufs
import (
	"bytes"
	"crypto/tls"
	"encoding/gob"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"regexp"
	"strconv"
	"strings"
	"devt.de/krotik/common/errorutil"
	"devt.de/krotik/common/fileutil"
	"devt.de/krotik/common/pools"
	"devt.de/krotik/common/stringutil"
	"devt.de/krotik/rufs/config"
	"devt.de/krotik/rufs/node"
)
func init() {
	gob.Register([][]os.FileInfo{})
	gob.Register(&FileInfo{})
}
type Branch struct {
	rootPath string          
	node     *node.RufsNode  
	readonly bool            
}