github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/libnetwork/endpoint_info_windows.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  	var gwDriverInfo map[string]interface{}
    15  	if sb, ok := ep.getSandbox(); ok {
    16  		if gwep := sb.getEndpointInGWNetwork(); gwep != nil && gwep.ID() != ep.ID() {
    17  
    18  			gwDriverInfo, err = gwep.DriverInfo()
    19  			if err != nil {
    20  				return nil, err
    21  			}
    22  		}
    23  	}
    24  
    25  	n, err := ep.getNetworkFromStore()
    26  	if err != nil {
    27  		return nil, fmt.Errorf("could not find network in store for driver info: %v", err)
    28  	}
    29  
    30  	driver, err := n.driver(true)
    31  	if err != nil {
    32  		return nil, fmt.Errorf("failed to get driver info: %v", err)
    33  	}
    34  
    35  	epInfo, err := driver.EndpointOperInfo(n.ID(), ep.ID())
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  
    40  	if epInfo != nil {
    41  		epInfo["GW_INFO"] = gwDriverInfo
    42  		return epInfo, nil
    43  	}
    44  
    45  	return gwDriverInfo, nil
    46  }