package client
import (
+ "errors"
"fmt"
"net"
"os"
- "errors"
"time"
"github.com/agl/ed25519"
+
"cypherpunks.ru/govpn"
)
func (c *Configuration) Validate() error {
if c.MTU > govpn.MTUMax {
- return fmt.Errorf("Invalid MTU %d, maximum allowable is %d",c.MTU, govpn.MTUMax)
+ return fmt.Errorf("Invalid MTU %d, maximum allowable is %d", c.MTU, govpn.MTUMax)
}
if len(c.RemoteAddress) == 0 {
return errors.New("Missing RemoteAddress")
config Configuration
// Error receive any error of all routines
- Error chan error
+ Error chan error
}
func (c *Client) MainCycle() {
go govpn.StatsProcessor(c.statsPort, &c.knownPeers)
}
- MainCycle:
+MainCycle:
for {
c.timeouted = make(chan struct{})
c.rehandshaking = make(chan struct{})
func NewClient(conf Configuration, verifier *govpn.Verifier, termSignal chan os.Signal) *Client {
client := &Client{
- idsCache: govpn.NewMACCache(),
+ idsCache: govpn.NewMACCache(),
firstUpCall: true,
- config: conf,
- termSignal: termSignal,
- Error: make(chan error, 1),
+ config: conf,
+ termSignal: termSignal,
+ Error: make(chan error, 1),
}
confs := map[govpn.PeerId]*govpn.PeerConf{*verifier.Id: conf.Peer}
client.idsCache.Update(&confs)
syslog = flag.Bool("syslog", false, "Enable logging to syslog")
version = flag.Bool("version", false, "Print version information")
warranty = flag.Bool("warranty", false, "Print warranty information")
- protocol client.Protocol
- err error
+ protocol client.Protocol
+ err error
)
flag.Parse()
Verifier: verifier,
DSAPriv: priv,
},
- Protocol: protocol,
- InterfaceName: *ifaceName,
- ProxyAddress: *proxyAddr,
+ Protocol: protocol,
+ InterfaceName: *ifaceName,
+ ProxyAddress: *proxyAddr,
ProxyAuthentication: *proxyAuth,
- RemoteAddress: *remoteAddr,
- UpPath: *upPath,
- DownPath: *downPath,
- StatsAddress: *stats,
- NoReconnect: *noreconnect,
- MTU: *mtu,
+ RemoteAddress: *remoteAddr,
+ UpPath: *upPath,
+ DownPath: *downPath,
+ StatsAddress: *stats,
+ NoReconnect: *noreconnect,
+ MTU: *mtu,
}
if err = conf.Validate(); err != nil {
log.Fatalln("Invalid settings:", err)