add dynamic IP attributions
This commit is contained in:
15
vpnserver.go
15
vpnserver.go
@@ -126,14 +126,6 @@ func (s *OpenVpnMgt) Version() (error, map[string][]string) {
|
||||
return nil, ret
|
||||
}
|
||||
|
||||
// internal DHCP
|
||||
func (s *OpenVpnMgt) getIP(c *vpnSession) (string, error) {
|
||||
// TODO implement
|
||||
ip := s.ldap[c.Profile].ipMin
|
||||
|
||||
return ip.String(), nil
|
||||
}
|
||||
|
||||
// called after a client is confirmed connected and authenticated
|
||||
func (s *OpenVpnMgt) ClientValidated(line, remote string) {
|
||||
err, c := s.getClient(line, remote)
|
||||
@@ -153,7 +145,6 @@ func (s *OpenVpnMgt) ClientValidated(line, remote string) {
|
||||
|
||||
// called after a client is disconnected, including for auth issues
|
||||
func (s *OpenVpnMgt) ClientDisconnect(line, remote string) {
|
||||
//TODO free the IP
|
||||
err, c := s.getClient(line, remote)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@@ -218,8 +209,6 @@ func (s *OpenVpnMgt) handleConn(conn net.Conn) {
|
||||
defer delete(s.buf, remote)
|
||||
defer delete(s.clients, remote)
|
||||
|
||||
// TODO : free all IPs if disconnected
|
||||
|
||||
// we store the buffer pointer in the struct, to be accessed from other methods
|
||||
s.buf[remote] = bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
|
||||
s.clients[remote] = make(map[int]*vpnSession)
|
||||
@@ -311,9 +300,5 @@ func (s *OpenVpnMgt) handleConn(conn net.Conn) {
|
||||
default:
|
||||
response = append(response, line)
|
||||
}
|
||||
// TODO remove this
|
||||
if false && strings.Index(line, "password") == -1 {
|
||||
log.Print(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user