Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1 KB

index.rst

File metadata and controls

42 lines (29 loc) · 1 KB

Welcome to pystructs' documentation!

from typing import List
from pystructs import fields

class Attribute(fields.Struct):
    type = fields.BytesField(size=1)
    length = fields.Int32Field(byteorder='big')
    value = fields.VariableBytesField(related_field='length')


class StunMessage(fields.Struct):
    type = fields.BytesField(size=1)
    length = fields.Int32Field(byteorder='big')
    attributes: List[Attribute] = fields.MultipleField(count='length', field=Attribute())

message = StunMessage(<bytes>)
message.initialize()

# Just use!

user/intro

fields/field fields/struct