2022-07-23 11:01:41 +00:00
|
|
|
package process
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/netip"
|
|
|
|
|
2022-08-15 03:40:49 +00:00
|
|
|
"github.com/sagernet/sing-box/log"
|
|
|
|
"github.com/sagernet/sing-tun"
|
2022-07-23 11:01:41 +00:00
|
|
|
E "github.com/sagernet/sing/common/exceptions"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Searcher interface {
|
|
|
|
FindProcessInfo(ctx context.Context, network string, srcIP netip.Addr, srcPort int) (*Info, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
var ErrNotFound = E.New("process not found")
|
|
|
|
|
2022-08-15 03:40:49 +00:00
|
|
|
type Config struct {
|
|
|
|
Logger log.ContextLogger
|
|
|
|
PackageManager tun.PackageManager
|
|
|
|
}
|
|
|
|
|
2022-07-23 11:01:41 +00:00
|
|
|
type Info struct {
|
|
|
|
ProcessPath string
|
|
|
|
PackageName string
|
|
|
|
User string
|
|
|
|
UserId int32
|
|
|
|
}
|