Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions netns_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ func GetFromThread(pid, tid int) (NsHandle, error) {
return GetFromPath(fmt.Sprintf("/proc/%d/task/%d/ns/net", pid, tid))
}

// GetFromPidWithAltProcfs gets a handle to the network namespace of a given
// pid using the specified procfs path.
func GetFromPidWithAltProcfs(pid int, procfs string) (NsHandle, error) {
return GetFromPath(fmt.Sprintf("%s/%d/ns/net", procfs, pid))
}

// GetFromThreadWithAltProcfs gets a handle to the network namespace of a given
// pid and tid using the specified procfs path.
func GetFromThreadWithAltProcfs(pid, tid int, procfs string) (NsHandle, error) {
return GetFromPath(fmt.Sprintf("%s/%d/task/%d/ns/net", procfs, pid, tid))
}

// GetFromDocker gets a handle to the network namespace of a docker container.
// Id is prefixed matched against the running docker containers, so a short
// identifier can be used as long as it isn't ambiguous.
Expand Down
8 changes: 8 additions & 0 deletions netns_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ func GetFromThread(pid int, tid int) (NsHandle, error) {
return -1, ErrNotImplemented
}

func GetFromPidWithAltProcfs(pid int, procfs string) (NsHandle, error) {
return -1, ErrNotImplemented
}

func GetFromThreadWithAltProcfs(pid, tid int, procfs string) (NsHandle, error) {
return -1, ErrNotImplemented
}

func GetFromDocker(id string) (NsHandle, error) {
return -1, ErrNotImplemented
}