Fixed found_ipvx filters
parent
a19b239969
commit
9cce98e737
9
index.js
9
index.js
|
@ -38,7 +38,7 @@ app.get('/', async (req,res) => {
|
|||
const privkey = req.query['del']
|
||||
const hostname = req.query['add']
|
||||
//const requester = req.ip.replace('::ffff:','')
|
||||
const requester = '10.4.9.1'
|
||||
const requester = '10.4.1.1'
|
||||
|
||||
// Delete a peer
|
||||
if (privkey) {
|
||||
|
@ -79,8 +79,8 @@ app.get('/', async (req,res) => {
|
|||
}
|
||||
else if (line.includes('AllowedIPs')) {
|
||||
const ips = line.split('=')[1].split(',')
|
||||
found_ipv4s.push(ips.filter( (ip) => ip.includes(IPV4_NET) ))
|
||||
found_ipv6s.push(ips.filter( (ip) => ip.includes(IPV6_NET) ))
|
||||
found_ipv4s.push(ips.filter( (ip) => ip.includes(IPV4_NET) )[0].trim())
|
||||
found_ipv6s.push(ips.filter( (ip) => ip.includes(IPV6_NET) )[0].trim())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,9 @@ app.get('/', async (req,res) => {
|
|||
res.sendStatus(500); return
|
||||
|
||||
// Check that the requester is "on the list"
|
||||
// Should never get here because this requester can't access this IP!
|
||||
} else if (found_usernames.length ===0) {
|
||||
console.log(`Requester ${requester} is not in the network yet`)
|
||||
console.log(`Received request from ${requester} not in wg.conf!`)
|
||||
res.sendStatus(500); return
|
||||
// Check that all usernames are correct or error out
|
||||
// https://stackoverflow.com/a/35568895
|
||||
|
|
Loading…
Reference in New Issue