Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
radius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
radius
Commits
20a7bf32
Commit
20a7bf32
authored
May 03, 2023
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
08f203bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
app.js
app.js
+7
-2
No files found.
app.js
View file @
20a7bf32
...
...
@@ -8,7 +8,7 @@ const server = dgram.createSocket('udp4');
server
.
on
(
'
message
'
,
(
msg
,
rinfo
)
=>
{
const
packet
=
radius
.
decode
({
packet
:
msg
,
secret
});
console
.
log
(
packet
)
if
(
packet
.
code
!==
'
Access-Request
'
)
{
console
.
error
(
'
Invalid packet type:
'
+
packet
.
code
);
return
;
...
...
@@ -19,6 +19,11 @@ console.log(packet)
console
.
log
(
'
Received access request from:
'
,
username
);
const
inputOctets
=
packet
.
attributes
[
'
Acct-Input-Octets
'
];
const
outputOctets
=
packet
.
attributes
[
'
Acct-Output-Octets
'
];
console
.
log
(
'
RX:
'
,
inputOctets
,
'
TX:
'
,
outputOctets
);
// Perform your user authentication logic here
const
isAuthenticated
=
authenticateUser
(
username
,
password
);
...
...
@@ -52,5 +57,5 @@ server.bind(port);
function
authenticateUser
(
username
,
password
)
{
console
.
log
(
username
,
password
)
// Replace this function with your actual authentication logic
return
username
===
'
ali
2
'
;
return
username
===
'
ali
'
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment