-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to receive message accounting at port 1813 #106
Comments
how about the port ? when server get started it will listen on port 1812 udp for authentication/authorization ? package main
import (
"log"
"layeh.com/radius"
"layeh.com/radius/rfc2865"
)
func main() {
handler := func(w radius.ResponseWriter, r *radius.Request) {
username := rfc2865.UserName_GetString(r.Packet)
password := rfc2865.UserPassword_GetString(r.Packet)
var code radius.Code
if username == "tim" && password == "12345" {
code = radius.CodeAccessAccept
} else {
code = radius.CodeAccessReject
}
log.Printf("Writing %v to %v", code, r.RemoteAddr)
w.Write(r.Response(code))
}
server := radius.PacketServer{
Handler: radius.HandlerFunc(handler),
SecretSource: radius.StaticSecretSource([]byte(`secret`)),
}
log.Printf("Starting server on :1812")
if err := server.ListenAndServe(); err != nil {
log.Fatal(err)
}
} |
Reference PacketServer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
anyone can give me some example code implement server accounting at port 1813
The text was updated successfully, but these errors were encountered: