Skip to content

Conversation

@ibigbug
Copy link
Member

@ibigbug ibigbug commented Nov 1, 2025

🤔 This is a ...

  • New feature
  • Bug fix
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

Closes #952

💡 Background and solution

This PR implements process name matching functionality for routing rules, allowing users to route traffic based on the process name that initiated the connection.

Problem:

  • The PROCESS-NAME rule matcher was previously unimplemented and always returned false
  • Users couldn't route traffic based on which application initiated the connection

Solution:

  • Added dependency on sock2proc crate for process name resolution
  • Implemented the apply method in Process rule matcher to:
    • Find the process name using socket information (source, destination, protocol)
    • Support both exact matching and substring matching based on name_only flag
    • Works on Unix-like systems (Linux, macOS)
    • Gracefully handles Windows (logs info message that it's not supported yet)

Usage:
Users can now use process-based routing rules in their configuration:

rules:
  - PROCESS-NAME,firefox,PROXY
  - PROCESS-NAME,chrome,DIRECT

📝 Changelog

Added:

  • Process name matching support for routing rules on Unix-like systems
  • New dependency: sock2proc crate for process name resolution
  • Debug logging for process name matching

Changed:

  • Process::apply() method now performs actual process name matching instead of returning false

Limitations:

  • Windows support not yet implemented (will be added in future PR)

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Changelog is provided or not needed

@ibigbug ibigbug changed the title feat: implement process name matching for routing rules feat(rule): implement process name matching for routing rules Nov 1, 2025
@ibigbug ibigbug enabled auto-merge (squash) November 3, 2025 08:10
@ibigbug ibigbug disabled auto-merge November 3, 2025 08:10
@ibigbug ibigbug merged commit cff16c6 into master Nov 3, 2025
33 checks passed
@ibigbug ibigbug deleted the issue-952 branch November 3, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add PROCESS-NAME Rule

2 participants