context.go 556 B

1234567891011121314151617181920212223242526272829
  1. package protocol
  2. type PacketContext struct {
  3. ReceiveAddress []byte
  4. Id string
  5. }
  6. // SetReceiveAddress 设置接收表地址
  7. func (a *PacketContext) SetReceiveAddress(address []byte) {
  8. a.ReceiveAddress = address
  9. }
  10. // GetReceiveAddress 获取接收表地址
  11. func (a *PacketContext) GetReceiveAddress() []byte {
  12. if a.ReceiveAddress != nil {
  13. return a.ReceiveAddress
  14. }
  15. return nil
  16. }
  17. // SetId 设置表号
  18. func (a *PacketContext) SetId(id string) {
  19. a.Id = id
  20. }
  21. // GetId 获取表号
  22. func (a *PacketContext) GetId() string {
  23. return a.Id
  24. }