@@ -154,15 +154,30 @@ type apipaClient interface {
154154 CreateHostNCApipaEndpoint (ctx context.Context , networkContainerID string ) (string , error )
155155}
156156
157+ func FormatStructPointers [T any ](slice []* T ) string {
158+ var builder strings.Builder
159+ for _ , ptr := range slice {
160+ if ptr != nil {
161+ fmt .Fprintf (& builder , "%+v \n " , * ptr )
162+ }
163+ }
164+ return builder .String ()
165+ }
166+
157167func (epInfo * EndpointInfo ) PrettyString () string {
158- return fmt .Sprintf ("Id:%s ContainerID:%s NetNsPath:%s IfName:%s IfIndex:%d MacAddr:%s IPAddrs:%v Gateways:%v Data:%+v NICType: %s NetworkContainerID: %s HostIfName: %s NetNs: %s Options: %v" ,
168+ return fmt .Sprintf ("Id:%s ContainerID:%s NetNsPath:%s IfName:%s IfIndex:%d MacAddr:%s IPAddrs:%v Gateways:%v Data:%+v NICType: %s NetworkContainerID: %s HostIfName: %s NetNs: %s Options: %v MasterIfName: %s IfName: %s HNSEndpointID: %s HNSNetworkID: %s " ,
159169 epInfo .EndpointID , epInfo .ContainerID , epInfo .NetNsPath , epInfo .IfName , epInfo .IfIndex , epInfo .MacAddress .String (), epInfo .IPAddresses ,
160- epInfo .Gateways , epInfo .Data , epInfo .NICType , epInfo .NetworkContainerID , epInfo .HostIfName , epInfo .NetNs , epInfo .Options )
170+ epInfo .Gateways , epInfo .Data , epInfo .NICType , epInfo .NetworkContainerID , epInfo .HostIfName , epInfo .NetNs , epInfo .Options , epInfo .MasterIfName ,
171+ epInfo .IfName , epInfo .HNSEndpointID , epInfo .HNSNetworkID )
161172}
162173
163174func (ifInfo * InterfaceInfo ) PrettyString () string {
164- return fmt .Sprintf ("Name:%s NICType:%v MacAddr:%s IPConfigs:%+v Routes:%+v DNSInfo:%+v" ,
165- ifInfo .Name , ifInfo .NICType , ifInfo .MacAddress .String (), ifInfo .IPConfigs , ifInfo .Routes , ifInfo .DNS )
175+ var ncresponse string
176+ if ifInfo .NCResponse != nil {
177+ ncresponse = fmt .Sprintf ("%+v" , * ifInfo .NCResponse )
178+ }
179+ return fmt .Sprintf ("Name:%s NICType:%v MacAddr:%s IPConfigs:%s Routes:%+v DNSInfo:%+v NCResponse: %s" ,
180+ ifInfo .Name , ifInfo .NICType , ifInfo .MacAddress .String (), FormatStructPointers (ifInfo .IPConfigs ), ifInfo .Routes , ifInfo .DNS , ncresponse )
166181}
167182
168183// NewEndpoint creates a new endpoint in the network.
0 commit comments