-
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
ability to get "string key" from Attribute Type? #13
Comments
Not at the moment. In order to put a I'll give some though to how this additional information can be generated in the dictionary packages. I'll also consider how this could support VSAs as well. |
Yeah I started looking at it and I know I maybe would have to filter by type I'm interested to map/it would "belong" in the "rfc" generated modules you have. For dumping/debugging I can definitely live with just the ints, but it'd be pretty awesome to not have to cross-reference myself! My only use case is just for dumping/debugging and I imagine suppoting a "attribute by string name" would be ill-advised but maybe there is an interesting way to do that. Anyway, any time you spend on this, thanks a lot (let me know if I can help)! |
That will definitely not be added (this was how the library was initially implemented, and was not ideal due to decreased type safety). The debugging information is useful though. |
Certainly agree! Debugging is the only use case I have and I can start to track to that if I need it for some attributes and I figured maybe it could be generated but didn't dive in. Again thanks and this library is super useful! |
There was some discussion in #15 about this, I've closed that and if there is more conversation to follow we can have it here (sorry for the non-linear conversation future readers) |
One thing I would like to avoid with a debug package is auto registering information. IE, there should be no: func init() {
debug.RegisterDictionary(...)
} As this would likely cause interference if you are trying to work several dictionaries whose types overlap (not common, but still possible).
I think this might be the way to go. The dictionary generator would generate an exported variable in the form: var RFC2865 = ...debug information... var RFC2866 = ...debug information... There would then be helper functions defined with signatures like: func DebugPacket(p *radius.Packet, ...*DebugType) (string, error) Or something similar. We also need to consider vendor specific attributes, and being able to convert them into a stringified form. |
Alright, I've taken a go at implementing this. There is a new package called
Not currently feature complete at the moment, so API and output format may break in the future. Let me know how this works for you and if you have any suggestions. |
I was looking at this, any chance (you are still updating so I figured a PR would get in the way)
could instead be
If I want to dump packets to a variety of places, I can deal with getting a string back but passing a writer directly would be nice |
Thanks for the effort on this!
^ pretty much solves my use case entirely. I'll do some more testing on my end but this is great! |
I did start using this and it fulfills my needs perfectly (thanks!) Feel free to close this issue if you feel the work is completed on your end |
Superseded by #35 |
Sorry if I missed it in the code but I can get the Type (as an int) of an attribute. Is there a way to know that, for example,
UserName_Type radius.Type = 1
== "User-Name"? (I'd like to dump attribute key/value pairs in a debugging mode)The text was updated successfully, but these errors were encountered: