github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/libnetwork/endpoint_info_unix.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package libnetwork
     5  
     6  import "fmt"
     7  
     8  func (ep *endpoint) DriverInfo() (map[string]interface{}, error) {
     9  	ep, err := ep.retrieveFromStore()
    10  	if err != nil {
    11  		return nil, err
    12  	}
    13  
    14  	if sb, ok := ep.getSandbox(); ok {
    15  		if gwep := sb.getEndpointInGWNetwork(); gwep != nil && gwep.ID() != ep.ID() {
    16  			return gwep.DriverInfo()
    17  		}
    18  	}
    19  
    20  	n, err := ep.getNetworkFromStore()
    21  	if err != nil {
    22  		return nil, fmt.Errorf("could not find network in store for driver info: %v", err)
    23  	}
    24  
    25  	driver, err := n.driver(true)
    26  	if err != nil {
    27  		return nil, fmt.Errorf("failed to get driver info: %v", err)
    28  	}
    29  
    30  	return driver.EndpointOperInfo(n.ID(), ep.ID())
    31  }