Get []u8 from IP addr struct #19677
Unanswered
MikhailMS
asked this question in
Questions and Answers
Replies: 2 comments 1 reply
-
If you get it as a string now, you can do str := 'hello'
println(str.bytes())
println(typeof(str.bytes()).name) output is
|
Beta Was this translation helpful? Give feedback.
1 reply
-
For IPv4 addresses the function
Output:
I've developed this program using the V Playground with v 0.4.1. Meanwhile there may be a more elegant solution using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there,
I am currently trying to implement a library (to work with RADIUS protocol) in V and as part of the work I need to be able to translate IPv4/IPv6 strings into bytes
I can see that there is a function
resolve_ipaddrs
instd.net
which almost does the job required - as in it parses and creates IP struct, however there is no way to get underlying bytes of those IP structs as they are private and there are no gettersIs there currently no way to do so or am I missing something (which is possible as I am just starting with V)?
Essentially, what would be great is to be able to (or maybe even to have a stand-alone function to do the parsing)
Beta Was this translation helpful? Give feedback.
All reactions