]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/cmd/govpn-server/main.go
go vet/lint
[govpn.git] / src / cypherpunks.ru / govpn / cmd / govpn-server / main.go
index c70e82a3f1da9d22f078ec2187a14eaf30428de6..2beb396f6958409a2cf0f27f9e938e6a76558d47 100644 (file)
@@ -1,6 +1,6 @@
 /*
 GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2017 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -39,6 +39,7 @@ var (
        proxy    = flag.String("proxy", "", "Enable HTTP proxy on host:port")
        egdPath  = flag.String("egd", "", "Optional path to EGD socket")
        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")
 )
 
@@ -48,6 +49,10 @@ func main() {
                fmt.Println(govpn.Warranty)
                return
        }
+       if *version {
+               fmt.Println(govpn.VersionGet())
+               return
+       }
        timeout := time.Second * time.Duration(govpn.TimeoutDefault)
        log.SetFlags(log.Ldate | log.Lmicroseconds | log.Lshortfile)
        log.Println(govpn.VersionGet())
@@ -103,7 +108,7 @@ MainCycle:
                        govpn.BothPrintf(`[terminating bind="%s"]`, *bindAddr)
                        for _, ps := range peers {
                                govpn.ScriptCall(
-                                       confs[*ps.peer.Id].Down,
+                                       confs[*ps.peer.ID].Down,
                                        ps.tap.Name,
                                        ps.peer.Addr,
                                )
@@ -120,7 +125,7 @@ MainCycle:
                                }
                        }
                        peersLock.Lock()
-                       peersByIdLock.Lock()
+                       peersByIDLock.Lock()
                        kpLock.Lock()
                        for addr, ps := range peers {
                                ps.peer.BusyR.Lock()
@@ -130,9 +135,9 @@ MainCycle:
                                        govpn.Printf(`[peer-delete bind="%s" peer="%s"]`, *bindAddr, ps.peer)
                                        delete(peers, addr)
                                        delete(knownPeers, addr)
-                                       delete(peersById, *ps.peer.Id)
+                                       delete(peersByID, *ps.peer.ID)
                                        go govpn.ScriptCall(
-                                               confs[*ps.peer.Id].Down,
+                                               confs[*ps.peer.ID].Down,
                                                ps.tap.Name,
                                                ps.peer.Addr,
                                        )
@@ -141,7 +146,7 @@ MainCycle:
                        }
                        hsLock.Unlock()
                        peersLock.Unlock()
-                       peersByIdLock.Unlock()
+                       peersByIDLock.Unlock()
                        kpLock.Unlock()
                }
        }