moznion / radius-rs

An async/await native implementation of the RADIUS server and client for Rust.
MIT License
88 stars 14 forks source link

Handling of Vendor Specific Attributes (VSA) #37

Closed ivanovuri closed 9 months ago

ivanovuri commented 1 year ago

Hi, As I see, there is no built-in functionality to add additional vendor specific attributes. I create one by myself, so what about to accept this little improvement. To add new VSA type we can use this example.

use radius::core::vsa::VSA;
use radius::core::rfc2865::add_vsa_attribute;
...
// 4874 - Vendor Juniper ID
// 65 - vsa type
// 5 is tag number. i.e. in the world of Juniper Subscriber Manager router receives ERX-Service-Activate:5
// value is some test string here
let new_vsa = VSA::new(4874, 65, 5, "bar(1000,5441)");
add_vsa_attribute(&mut p, &new_vsa);
aiguy110 commented 1 year ago

Is there anything preventing this from being merged? Would love an in-library way to handle VSAs more cleanly than AVP::encode_bytes.

moznion commented 9 months ago

@ivanovuri I appreciate your contribution. I'm sorry for late response. I'll publish new version which includes this change and let you know that once it has finished.

moznion commented 9 months ago

@ivanovuri @aiguy110 I published v0.4.0 which includes this change. Thank you for your contribution!