mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 10:00:34 +00:00
21 lines
709 B
Go
21 lines
709 B
Go
|
|
//go:build android
|
||
|
|
|
||
|
|
package net
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/xtls/xray-core/common/errors"
|
||
|
|
)
|
||
|
|
|
||
|
|
var androidProcessFinder func(network, srcIP string, srcPort uint16, destIP string, destPort uint16) (int, string, string, error)
|
||
|
|
|
||
|
|
func RegisterAndroidProcessFinder(f func(network, srcIP string, srcPort uint16, destIP string, destPort uint16) (int, string, string, error)) {
|
||
|
|
androidProcessFinder = f
|
||
|
|
}
|
||
|
|
|
||
|
|
func FindProcess(network, srcIP string, srcPort uint16, destIP string, destPort uint16) (int, string, string, error) {
|
||
|
|
if androidProcessFinder != nil {
|
||
|
|
return androidProcessFinder(network, srcIP, srcPort, destIP, destPort)
|
||
|
|
}
|
||
|
|
return 0, "", "", errors.New("android process lookup must be registered before use")
|
||
|
|
}
|