func Load(r io.Reader) (*Config, error) {
	return parse(ini.Parse(r))
}
Load loads and parses an io.Reader as a tunnel config, returning a
Config pointer or an error.
package conf
import (
	"fmt"
	"io"
	"net"
	"sort"
	"github.com/calmh/mole/ini"
)
const (
	defaultSSHPort = 22
)
const (
	FeatureError uint32 = 1 << iota
	FeatureSshPassword
	FeatureSshKey
	FeatureVpnc
	FeatureOpenConnect
	FeatureLocalOnly
	FeatureSocks
)
type Config struct {
	Comments []string
	General struct {
		Description string
		Author      string
		Main        string
		Version     int
		Other       map[string]string
		Comments    []string
	}
	Hosts       []Host
	Forwards    []Forward
	HostsMap    map[string]int
	OpenConnect map[string]string
	Vpnc        map[string]string
	VpnRoutes   []string
}
type Host struct {
	Name     string
	Addr     string
	Port     int
	User     string
	Key      string
	Pass     string
	Via      string
	SOCKS    string
	Other    map[string]string
	Comments []string
}
type Forward struct {
	Name     string
	Lines    []ForwardLine
	Other    map[string]string
	Comments []string
}
type Addrports struct {
	Addr  net.IP
	Ports []int
}
type ForwardLine struct {
	Src Addrports
	Dst Addrports
}
func (line ForwardLine) SrcString(i int) string {
	if i >= len(line.Src.Ports) {
		panic("index > repeat")
	}
	if line.Src.Addr.To4() != nil {
		return fmt.Sprintf("%s:%d", line.Src.Addr.String(), line.Src.Ports[i])
	} else {
		return fmt.Sprintf("[%s]:%d", line.Src.Addr.String(), line.Src.Ports[i])
	}
}
func (line ForwardLine) DstString(i int) string {
	if i >= len(line.Dst.Ports) {
		panic("index > repeat")
	}
	if line.Dst.Addr.To4() != nil {
		return fmt.Sprintf("%s:%d", line.Dst.Addr.String(), line.Dst.Ports[i])
	} else {
		return fmt.Sprintf("[%s]:%d", line.Dst.Addr.String(), line.Dst.Ports[i])
	}
}
func (line ForwardLine) String() string {
	if len(line.Src.Ports) == 1 {
		src := fmt.Sprintf("%s:%d", line.Src.Addr.String(), line.Src.Ports[0])
		dst := fmt.Sprintf("%s:%d", line.Dst.Addr.String(), line.Dst.Ports[0])
		return fmt.Sprintf("%s -> %s", src, dst)
	}
	src := fmt.Sprintf("%s:%d-%d", line.Src.Addr.String(), line.Src.Ports[0], line.Src.Ports[len(line.Src.Ports)-1])
	dst := fmt.Sprintf("%s:%d-%d", line.Dst.Addr.String(), line.Dst.Ports[0], line.Dst.Ports[len(line.Src.Ports)-1])
	return fmt.Sprintf("%s -> %s", src, dst)
}