Skip to content

Hook and Priority cannot be directly compared with predefined values #318

@wjiec

Description

@wjiec

Hi,

When obtaining chains using methods such as ListChains, the hookFromMsg method directly returns a new pointer, which prevents it from being directly compared with defined values in the package (e.g., ChainHookPrerouting or ChainPriorityNATDest). In actual use, it is necessary to first determine whether this pointer is nil, then dereference the pointer and check if they are the same. To be honest, this is quite cumbersome. For this, I think we could add some small features:

  • Add an Equals(*ChainXXX) bool method for *ChainHook and *ChainPriority types.
  • Modify the logic of hookFromMsg to directly return the defined value instead of creating a new pointer.
  • Implement both of the above solutions to facilitate the determination of custom values (e.g., Priority).

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions