Skip to content

Store IP addresses as netaddr.IPAddress instead of str #17

@benediktkr

Description

@benediktkr

Wherever ip addresses are stored, we should use netaddr.IPAddress instead of the standard Python str.

>>> ip = IPAddress("1.1.1.1")
>>> ip
IPAddress('1.1.1.1')
>>> str(ip)
'1.1.1.1'
>>> repr(ip)
"IPAddress('1.1.1.1')" 
>>>

Although we might want to override IPAddress.__repr__() to return IPAddress.__str__().

Currently, this is possible

>>> vpn31 = model.Node.get("vpn31")  
>>> vpn31.ip = "79.134.237.10722"
>>> vpn31.save() 
>>> model.Node.get("vpn31")
{'name': 'vpn31', .... , 'ip': '79.134.237.10722'}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions