Skip to content
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 use rfc2866 #103

Open
mohamadpk opened this issue Aug 4, 2022 · 1 comment
Open

how to use rfc2866 #103

mohamadpk opened this issue Aug 4, 2022 · 1 comment

Comments

@mohamadpk
Copy link

how i can to send Service-Type ,Framed-Protocol ,NAS-Port,NAS-Port-Type,User-Name,Calling-Station-Id,Called-Station-Id,Acct-Session-Id,Framed-IP-Address,Acct-Authentic,Event-Timestamp,Acct-Status-Type,NAS-Identifier,Acct-Delay-Time,NAS-IP-Address ,
in CodeAccountingRequest?
User-Name is important to my.
i can add sessionid to packet with this code

	rfc2866.AcctSessionID_Add(packet, []byte("sssssssssssssssssss"))
	rfc2866.AcctStatusType_Add(packet, rfc2866.AcctStatusType_Value_Start)

how i can add User-Name?

@DiniFarb
Copy link

Hi @mohamadpk

Your listed attributes are from both rfc's, since rfc2866(accounting) extends rfc2865 you can use them togheter. Here the client example from the readme alterd to mixed attributs:

package main

import (
	"context"
	"log"

	"layeh.com/radius"
	"layeh.com/radius/rfc2865"
	"layeh.com/radius/rfc2866"
)

func main() {
	packet := radius.New(radius.CodeAccountingRequest, []byte(`secret`))
	rfc2865.UserName_SetString(packet, "tim")
	rfc2865.CallingStationID_AddString(packet, "1.1.1.1")
	rfc2866.AcctSessionID_Add(packet, []byte("sssssssssssssssssss"))
	rfc2866.AcctStatusType_Add(packet, rfc2866.AcctStatusType_Value_Start)
	response, err := radius.Exchange(context.Background(), packet, "localhost:1812")
	if err != nil {
		log.Fatal(err)
	}

	log.Println("Code:", response.Code)
}

Which results in a clean radius request here shown in wireshark:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants