mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-10 18:56:55 +02:00
feat(api): add GetContainer endpoint and Docker host ID mapping
- Implemented GetContainer function to retrieve container details by ID. - Introduced idDockerHostMap for mapping container IDs to Docker hosts. - Updated Container struct to allow omitting the State field in JSON responses.
This commit is contained in:
19
internal/docker/id_lookup.go
Normal file
19
internal/docker/id_lookup.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"github.com/puzpuzpuz/xsync/v4"
|
||||
)
|
||||
|
||||
var idDockerHostMap = xsync.NewMap[string, string]()
|
||||
|
||||
func GetDockerHostByContainerID(id string) (string, bool) {
|
||||
return idDockerHostMap.Load(id)
|
||||
}
|
||||
|
||||
func SetDockerHostByContainerID(id, host string) {
|
||||
idDockerHostMap.Store(id, host)
|
||||
}
|
||||
|
||||
func DeleteDockerHostByContainerID(id string) {
|
||||
idDockerHostMap.Delete(id)
|
||||
}
|
||||
Reference in New Issue
Block a user