github.com/ethereum-optimism/optimism@v1.7.2/op-node/p2p/mocks/API.go (about) 1 // Code generated by mockery v2.28.1. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 context "context" 7 8 enode "github.com/ethereum/go-ethereum/p2p/enode" 9 mock "github.com/stretchr/testify/mock" 10 11 net "net" 12 13 p2p "github.com/ethereum-optimism/optimism/op-node/p2p" 14 15 peer "github.com/libp2p/go-libp2p/core/peer" 16 ) 17 18 // API is an autogenerated mock type for the API type 19 type API struct { 20 mock.Mock 21 } 22 23 type API_Expecter struct { 24 mock *mock.Mock 25 } 26 27 func (_m *API) EXPECT() *API_Expecter { 28 return &API_Expecter{mock: &_m.Mock} 29 } 30 31 // BlockAddr provides a mock function with given fields: ctx, ip 32 func (_m *API) BlockAddr(ctx context.Context, ip net.IP) error { 33 ret := _m.Called(ctx, ip) 34 35 var r0 error 36 if rf, ok := ret.Get(0).(func(context.Context, net.IP) error); ok { 37 r0 = rf(ctx, ip) 38 } else { 39 r0 = ret.Error(0) 40 } 41 42 return r0 43 } 44 45 // API_BlockAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockAddr' 46 type API_BlockAddr_Call struct { 47 *mock.Call 48 } 49 50 // BlockAddr is a helper method to define mock.On call 51 // - ctx context.Context 52 // - ip net.IP 53 func (_e *API_Expecter) BlockAddr(ctx interface{}, ip interface{}) *API_BlockAddr_Call { 54 return &API_BlockAddr_Call{Call: _e.mock.On("BlockAddr", ctx, ip)} 55 } 56 57 func (_c *API_BlockAddr_Call) Run(run func(ctx context.Context, ip net.IP)) *API_BlockAddr_Call { 58 _c.Call.Run(func(args mock.Arguments) { 59 run(args[0].(context.Context), args[1].(net.IP)) 60 }) 61 return _c 62 } 63 64 func (_c *API_BlockAddr_Call) Return(_a0 error) *API_BlockAddr_Call { 65 _c.Call.Return(_a0) 66 return _c 67 } 68 69 func (_c *API_BlockAddr_Call) RunAndReturn(run func(context.Context, net.IP) error) *API_BlockAddr_Call { 70 _c.Call.Return(run) 71 return _c 72 } 73 74 // BlockPeer provides a mock function with given fields: ctx, p 75 func (_m *API) BlockPeer(ctx context.Context, p peer.ID) error { 76 ret := _m.Called(ctx, p) 77 78 var r0 error 79 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) error); ok { 80 r0 = rf(ctx, p) 81 } else { 82 r0 = ret.Error(0) 83 } 84 85 return r0 86 } 87 88 // API_BlockPeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockPeer' 89 type API_BlockPeer_Call struct { 90 *mock.Call 91 } 92 93 // BlockPeer is a helper method to define mock.On call 94 // - ctx context.Context 95 // - p peer.ID 96 func (_e *API_Expecter) BlockPeer(ctx interface{}, p interface{}) *API_BlockPeer_Call { 97 return &API_BlockPeer_Call{Call: _e.mock.On("BlockPeer", ctx, p)} 98 } 99 100 func (_c *API_BlockPeer_Call) Run(run func(ctx context.Context, p peer.ID)) *API_BlockPeer_Call { 101 _c.Call.Run(func(args mock.Arguments) { 102 run(args[0].(context.Context), args[1].(peer.ID)) 103 }) 104 return _c 105 } 106 107 func (_c *API_BlockPeer_Call) Return(_a0 error) *API_BlockPeer_Call { 108 _c.Call.Return(_a0) 109 return _c 110 } 111 112 func (_c *API_BlockPeer_Call) RunAndReturn(run func(context.Context, peer.ID) error) *API_BlockPeer_Call { 113 _c.Call.Return(run) 114 return _c 115 } 116 117 // BlockSubnet provides a mock function with given fields: ctx, ipnet 118 func (_m *API) BlockSubnet(ctx context.Context, ipnet *net.IPNet) error { 119 ret := _m.Called(ctx, ipnet) 120 121 var r0 error 122 if rf, ok := ret.Get(0).(func(context.Context, *net.IPNet) error); ok { 123 r0 = rf(ctx, ipnet) 124 } else { 125 r0 = ret.Error(0) 126 } 127 128 return r0 129 } 130 131 // API_BlockSubnet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockSubnet' 132 type API_BlockSubnet_Call struct { 133 *mock.Call 134 } 135 136 // BlockSubnet is a helper method to define mock.On call 137 // - ctx context.Context 138 // - ipnet *net.IPNet 139 func (_e *API_Expecter) BlockSubnet(ctx interface{}, ipnet interface{}) *API_BlockSubnet_Call { 140 return &API_BlockSubnet_Call{Call: _e.mock.On("BlockSubnet", ctx, ipnet)} 141 } 142 143 func (_c *API_BlockSubnet_Call) Run(run func(ctx context.Context, ipnet *net.IPNet)) *API_BlockSubnet_Call { 144 _c.Call.Run(func(args mock.Arguments) { 145 run(args[0].(context.Context), args[1].(*net.IPNet)) 146 }) 147 return _c 148 } 149 150 func (_c *API_BlockSubnet_Call) Return(_a0 error) *API_BlockSubnet_Call { 151 _c.Call.Return(_a0) 152 return _c 153 } 154 155 func (_c *API_BlockSubnet_Call) RunAndReturn(run func(context.Context, *net.IPNet) error) *API_BlockSubnet_Call { 156 _c.Call.Return(run) 157 return _c 158 } 159 160 // ConnectPeer provides a mock function with given fields: ctx, addr 161 func (_m *API) ConnectPeer(ctx context.Context, addr string) error { 162 ret := _m.Called(ctx, addr) 163 164 var r0 error 165 if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { 166 r0 = rf(ctx, addr) 167 } else { 168 r0 = ret.Error(0) 169 } 170 171 return r0 172 } 173 174 // API_ConnectPeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConnectPeer' 175 type API_ConnectPeer_Call struct { 176 *mock.Call 177 } 178 179 // ConnectPeer is a helper method to define mock.On call 180 // - ctx context.Context 181 // - addr string 182 func (_e *API_Expecter) ConnectPeer(ctx interface{}, addr interface{}) *API_ConnectPeer_Call { 183 return &API_ConnectPeer_Call{Call: _e.mock.On("ConnectPeer", ctx, addr)} 184 } 185 186 func (_c *API_ConnectPeer_Call) Run(run func(ctx context.Context, addr string)) *API_ConnectPeer_Call { 187 _c.Call.Run(func(args mock.Arguments) { 188 run(args[0].(context.Context), args[1].(string)) 189 }) 190 return _c 191 } 192 193 func (_c *API_ConnectPeer_Call) Return(_a0 error) *API_ConnectPeer_Call { 194 _c.Call.Return(_a0) 195 return _c 196 } 197 198 func (_c *API_ConnectPeer_Call) RunAndReturn(run func(context.Context, string) error) *API_ConnectPeer_Call { 199 _c.Call.Return(run) 200 return _c 201 } 202 203 // DisconnectPeer provides a mock function with given fields: ctx, id 204 func (_m *API) DisconnectPeer(ctx context.Context, id peer.ID) error { 205 ret := _m.Called(ctx, id) 206 207 var r0 error 208 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) error); ok { 209 r0 = rf(ctx, id) 210 } else { 211 r0 = ret.Error(0) 212 } 213 214 return r0 215 } 216 217 // API_DisconnectPeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisconnectPeer' 218 type API_DisconnectPeer_Call struct { 219 *mock.Call 220 } 221 222 // DisconnectPeer is a helper method to define mock.On call 223 // - ctx context.Context 224 // - id peer.ID 225 func (_e *API_Expecter) DisconnectPeer(ctx interface{}, id interface{}) *API_DisconnectPeer_Call { 226 return &API_DisconnectPeer_Call{Call: _e.mock.On("DisconnectPeer", ctx, id)} 227 } 228 229 func (_c *API_DisconnectPeer_Call) Run(run func(ctx context.Context, id peer.ID)) *API_DisconnectPeer_Call { 230 _c.Call.Run(func(args mock.Arguments) { 231 run(args[0].(context.Context), args[1].(peer.ID)) 232 }) 233 return _c 234 } 235 236 func (_c *API_DisconnectPeer_Call) Return(_a0 error) *API_DisconnectPeer_Call { 237 _c.Call.Return(_a0) 238 return _c 239 } 240 241 func (_c *API_DisconnectPeer_Call) RunAndReturn(run func(context.Context, peer.ID) error) *API_DisconnectPeer_Call { 242 _c.Call.Return(run) 243 return _c 244 } 245 246 // DiscoveryTable provides a mock function with given fields: ctx 247 func (_m *API) DiscoveryTable(ctx context.Context) ([]*enode.Node, error) { 248 ret := _m.Called(ctx) 249 250 var r0 []*enode.Node 251 var r1 error 252 if rf, ok := ret.Get(0).(func(context.Context) ([]*enode.Node, error)); ok { 253 return rf(ctx) 254 } 255 if rf, ok := ret.Get(0).(func(context.Context) []*enode.Node); ok { 256 r0 = rf(ctx) 257 } else { 258 if ret.Get(0) != nil { 259 r0 = ret.Get(0).([]*enode.Node) 260 } 261 } 262 263 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 264 r1 = rf(ctx) 265 } else { 266 r1 = ret.Error(1) 267 } 268 269 return r0, r1 270 } 271 272 // API_DiscoveryTable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DiscoveryTable' 273 type API_DiscoveryTable_Call struct { 274 *mock.Call 275 } 276 277 // DiscoveryTable is a helper method to define mock.On call 278 // - ctx context.Context 279 func (_e *API_Expecter) DiscoveryTable(ctx interface{}) *API_DiscoveryTable_Call { 280 return &API_DiscoveryTable_Call{Call: _e.mock.On("DiscoveryTable", ctx)} 281 } 282 283 func (_c *API_DiscoveryTable_Call) Run(run func(ctx context.Context)) *API_DiscoveryTable_Call { 284 _c.Call.Run(func(args mock.Arguments) { 285 run(args[0].(context.Context)) 286 }) 287 return _c 288 } 289 290 func (_c *API_DiscoveryTable_Call) Return(_a0 []*enode.Node, _a1 error) *API_DiscoveryTable_Call { 291 _c.Call.Return(_a0, _a1) 292 return _c 293 } 294 295 func (_c *API_DiscoveryTable_Call) RunAndReturn(run func(context.Context) ([]*enode.Node, error)) *API_DiscoveryTable_Call { 296 _c.Call.Return(run) 297 return _c 298 } 299 300 // ListBlockedAddrs provides a mock function with given fields: ctx 301 func (_m *API) ListBlockedAddrs(ctx context.Context) ([]net.IP, error) { 302 ret := _m.Called(ctx) 303 304 var r0 []net.IP 305 var r1 error 306 if rf, ok := ret.Get(0).(func(context.Context) ([]net.IP, error)); ok { 307 return rf(ctx) 308 } 309 if rf, ok := ret.Get(0).(func(context.Context) []net.IP); ok { 310 r0 = rf(ctx) 311 } else { 312 if ret.Get(0) != nil { 313 r0 = ret.Get(0).([]net.IP) 314 } 315 } 316 317 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 318 r1 = rf(ctx) 319 } else { 320 r1 = ret.Error(1) 321 } 322 323 return r0, r1 324 } 325 326 // API_ListBlockedAddrs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBlockedAddrs' 327 type API_ListBlockedAddrs_Call struct { 328 *mock.Call 329 } 330 331 // ListBlockedAddrs is a helper method to define mock.On call 332 // - ctx context.Context 333 func (_e *API_Expecter) ListBlockedAddrs(ctx interface{}) *API_ListBlockedAddrs_Call { 334 return &API_ListBlockedAddrs_Call{Call: _e.mock.On("ListBlockedAddrs", ctx)} 335 } 336 337 func (_c *API_ListBlockedAddrs_Call) Run(run func(ctx context.Context)) *API_ListBlockedAddrs_Call { 338 _c.Call.Run(func(args mock.Arguments) { 339 run(args[0].(context.Context)) 340 }) 341 return _c 342 } 343 344 func (_c *API_ListBlockedAddrs_Call) Return(_a0 []net.IP, _a1 error) *API_ListBlockedAddrs_Call { 345 _c.Call.Return(_a0, _a1) 346 return _c 347 } 348 349 func (_c *API_ListBlockedAddrs_Call) RunAndReturn(run func(context.Context) ([]net.IP, error)) *API_ListBlockedAddrs_Call { 350 _c.Call.Return(run) 351 return _c 352 } 353 354 // ListBlockedPeers provides a mock function with given fields: ctx 355 func (_m *API) ListBlockedPeers(ctx context.Context) ([]peer.ID, error) { 356 ret := _m.Called(ctx) 357 358 var r0 []peer.ID 359 var r1 error 360 if rf, ok := ret.Get(0).(func(context.Context) ([]peer.ID, error)); ok { 361 return rf(ctx) 362 } 363 if rf, ok := ret.Get(0).(func(context.Context) []peer.ID); ok { 364 r0 = rf(ctx) 365 } else { 366 if ret.Get(0) != nil { 367 r0 = ret.Get(0).([]peer.ID) 368 } 369 } 370 371 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 372 r1 = rf(ctx) 373 } else { 374 r1 = ret.Error(1) 375 } 376 377 return r0, r1 378 } 379 380 // API_ListBlockedPeers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBlockedPeers' 381 type API_ListBlockedPeers_Call struct { 382 *mock.Call 383 } 384 385 // ListBlockedPeers is a helper method to define mock.On call 386 // - ctx context.Context 387 func (_e *API_Expecter) ListBlockedPeers(ctx interface{}) *API_ListBlockedPeers_Call { 388 return &API_ListBlockedPeers_Call{Call: _e.mock.On("ListBlockedPeers", ctx)} 389 } 390 391 func (_c *API_ListBlockedPeers_Call) Run(run func(ctx context.Context)) *API_ListBlockedPeers_Call { 392 _c.Call.Run(func(args mock.Arguments) { 393 run(args[0].(context.Context)) 394 }) 395 return _c 396 } 397 398 func (_c *API_ListBlockedPeers_Call) Return(_a0 []peer.ID, _a1 error) *API_ListBlockedPeers_Call { 399 _c.Call.Return(_a0, _a1) 400 return _c 401 } 402 403 func (_c *API_ListBlockedPeers_Call) RunAndReturn(run func(context.Context) ([]peer.ID, error)) *API_ListBlockedPeers_Call { 404 _c.Call.Return(run) 405 return _c 406 } 407 408 // ListBlockedSubnets provides a mock function with given fields: ctx 409 func (_m *API) ListBlockedSubnets(ctx context.Context) ([]*net.IPNet, error) { 410 ret := _m.Called(ctx) 411 412 var r0 []*net.IPNet 413 var r1 error 414 if rf, ok := ret.Get(0).(func(context.Context) ([]*net.IPNet, error)); ok { 415 return rf(ctx) 416 } 417 if rf, ok := ret.Get(0).(func(context.Context) []*net.IPNet); ok { 418 r0 = rf(ctx) 419 } else { 420 if ret.Get(0) != nil { 421 r0 = ret.Get(0).([]*net.IPNet) 422 } 423 } 424 425 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 426 r1 = rf(ctx) 427 } else { 428 r1 = ret.Error(1) 429 } 430 431 return r0, r1 432 } 433 434 // API_ListBlockedSubnets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBlockedSubnets' 435 type API_ListBlockedSubnets_Call struct { 436 *mock.Call 437 } 438 439 // ListBlockedSubnets is a helper method to define mock.On call 440 // - ctx context.Context 441 func (_e *API_Expecter) ListBlockedSubnets(ctx interface{}) *API_ListBlockedSubnets_Call { 442 return &API_ListBlockedSubnets_Call{Call: _e.mock.On("ListBlockedSubnets", ctx)} 443 } 444 445 func (_c *API_ListBlockedSubnets_Call) Run(run func(ctx context.Context)) *API_ListBlockedSubnets_Call { 446 _c.Call.Run(func(args mock.Arguments) { 447 run(args[0].(context.Context)) 448 }) 449 return _c 450 } 451 452 func (_c *API_ListBlockedSubnets_Call) Return(_a0 []*net.IPNet, _a1 error) *API_ListBlockedSubnets_Call { 453 _c.Call.Return(_a0, _a1) 454 return _c 455 } 456 457 func (_c *API_ListBlockedSubnets_Call) RunAndReturn(run func(context.Context) ([]*net.IPNet, error)) *API_ListBlockedSubnets_Call { 458 _c.Call.Return(run) 459 return _c 460 } 461 462 // PeerStats provides a mock function with given fields: ctx 463 func (_m *API) PeerStats(ctx context.Context) (*p2p.PeerStats, error) { 464 ret := _m.Called(ctx) 465 466 var r0 *p2p.PeerStats 467 var r1 error 468 if rf, ok := ret.Get(0).(func(context.Context) (*p2p.PeerStats, error)); ok { 469 return rf(ctx) 470 } 471 if rf, ok := ret.Get(0).(func(context.Context) *p2p.PeerStats); ok { 472 r0 = rf(ctx) 473 } else { 474 if ret.Get(0) != nil { 475 r0 = ret.Get(0).(*p2p.PeerStats) 476 } 477 } 478 479 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 480 r1 = rf(ctx) 481 } else { 482 r1 = ret.Error(1) 483 } 484 485 return r0, r1 486 } 487 488 // API_PeerStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PeerStats' 489 type API_PeerStats_Call struct { 490 *mock.Call 491 } 492 493 // PeerStats is a helper method to define mock.On call 494 // - ctx context.Context 495 func (_e *API_Expecter) PeerStats(ctx interface{}) *API_PeerStats_Call { 496 return &API_PeerStats_Call{Call: _e.mock.On("PeerStats", ctx)} 497 } 498 499 func (_c *API_PeerStats_Call) Run(run func(ctx context.Context)) *API_PeerStats_Call { 500 _c.Call.Run(func(args mock.Arguments) { 501 run(args[0].(context.Context)) 502 }) 503 return _c 504 } 505 506 func (_c *API_PeerStats_Call) Return(_a0 *p2p.PeerStats, _a1 error) *API_PeerStats_Call { 507 _c.Call.Return(_a0, _a1) 508 return _c 509 } 510 511 func (_c *API_PeerStats_Call) RunAndReturn(run func(context.Context) (*p2p.PeerStats, error)) *API_PeerStats_Call { 512 _c.Call.Return(run) 513 return _c 514 } 515 516 // Peers provides a mock function with given fields: ctx, connected 517 func (_m *API) Peers(ctx context.Context, connected bool) (*p2p.PeerDump, error) { 518 ret := _m.Called(ctx, connected) 519 520 var r0 *p2p.PeerDump 521 var r1 error 522 if rf, ok := ret.Get(0).(func(context.Context, bool) (*p2p.PeerDump, error)); ok { 523 return rf(ctx, connected) 524 } 525 if rf, ok := ret.Get(0).(func(context.Context, bool) *p2p.PeerDump); ok { 526 r0 = rf(ctx, connected) 527 } else { 528 if ret.Get(0) != nil { 529 r0 = ret.Get(0).(*p2p.PeerDump) 530 } 531 } 532 533 if rf, ok := ret.Get(1).(func(context.Context, bool) error); ok { 534 r1 = rf(ctx, connected) 535 } else { 536 r1 = ret.Error(1) 537 } 538 539 return r0, r1 540 } 541 542 // API_Peers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Peers' 543 type API_Peers_Call struct { 544 *mock.Call 545 } 546 547 // Peers is a helper method to define mock.On call 548 // - ctx context.Context 549 // - connected bool 550 func (_e *API_Expecter) Peers(ctx interface{}, connected interface{}) *API_Peers_Call { 551 return &API_Peers_Call{Call: _e.mock.On("Peers", ctx, connected)} 552 } 553 554 func (_c *API_Peers_Call) Run(run func(ctx context.Context, connected bool)) *API_Peers_Call { 555 _c.Call.Run(func(args mock.Arguments) { 556 run(args[0].(context.Context), args[1].(bool)) 557 }) 558 return _c 559 } 560 561 func (_c *API_Peers_Call) Return(_a0 *p2p.PeerDump, _a1 error) *API_Peers_Call { 562 _c.Call.Return(_a0, _a1) 563 return _c 564 } 565 566 func (_c *API_Peers_Call) RunAndReturn(run func(context.Context, bool) (*p2p.PeerDump, error)) *API_Peers_Call { 567 _c.Call.Return(run) 568 return _c 569 } 570 571 // ProtectPeer provides a mock function with given fields: ctx, p 572 func (_m *API) ProtectPeer(ctx context.Context, p peer.ID) error { 573 ret := _m.Called(ctx, p) 574 575 var r0 error 576 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) error); ok { 577 r0 = rf(ctx, p) 578 } else { 579 r0 = ret.Error(0) 580 } 581 582 return r0 583 } 584 585 // API_ProtectPeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProtectPeer' 586 type API_ProtectPeer_Call struct { 587 *mock.Call 588 } 589 590 // ProtectPeer is a helper method to define mock.On call 591 // - ctx context.Context 592 // - p peer.ID 593 func (_e *API_Expecter) ProtectPeer(ctx interface{}, p interface{}) *API_ProtectPeer_Call { 594 return &API_ProtectPeer_Call{Call: _e.mock.On("ProtectPeer", ctx, p)} 595 } 596 597 func (_c *API_ProtectPeer_Call) Run(run func(ctx context.Context, p peer.ID)) *API_ProtectPeer_Call { 598 _c.Call.Run(func(args mock.Arguments) { 599 run(args[0].(context.Context), args[1].(peer.ID)) 600 }) 601 return _c 602 } 603 604 func (_c *API_ProtectPeer_Call) Return(_a0 error) *API_ProtectPeer_Call { 605 _c.Call.Return(_a0) 606 return _c 607 } 608 609 func (_c *API_ProtectPeer_Call) RunAndReturn(run func(context.Context, peer.ID) error) *API_ProtectPeer_Call { 610 _c.Call.Return(run) 611 return _c 612 } 613 614 // Self provides a mock function with given fields: ctx 615 func (_m *API) Self(ctx context.Context) (*p2p.PeerInfo, error) { 616 ret := _m.Called(ctx) 617 618 var r0 *p2p.PeerInfo 619 var r1 error 620 if rf, ok := ret.Get(0).(func(context.Context) (*p2p.PeerInfo, error)); ok { 621 return rf(ctx) 622 } 623 if rf, ok := ret.Get(0).(func(context.Context) *p2p.PeerInfo); ok { 624 r0 = rf(ctx) 625 } else { 626 if ret.Get(0) != nil { 627 r0 = ret.Get(0).(*p2p.PeerInfo) 628 } 629 } 630 631 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 632 r1 = rf(ctx) 633 } else { 634 r1 = ret.Error(1) 635 } 636 637 return r0, r1 638 } 639 640 // API_Self_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Self' 641 type API_Self_Call struct { 642 *mock.Call 643 } 644 645 // Self is a helper method to define mock.On call 646 // - ctx context.Context 647 func (_e *API_Expecter) Self(ctx interface{}) *API_Self_Call { 648 return &API_Self_Call{Call: _e.mock.On("Self", ctx)} 649 } 650 651 func (_c *API_Self_Call) Run(run func(ctx context.Context)) *API_Self_Call { 652 _c.Call.Run(func(args mock.Arguments) { 653 run(args[0].(context.Context)) 654 }) 655 return _c 656 } 657 658 func (_c *API_Self_Call) Return(_a0 *p2p.PeerInfo, _a1 error) *API_Self_Call { 659 _c.Call.Return(_a0, _a1) 660 return _c 661 } 662 663 func (_c *API_Self_Call) RunAndReturn(run func(context.Context) (*p2p.PeerInfo, error)) *API_Self_Call { 664 _c.Call.Return(run) 665 return _c 666 } 667 668 // UnblockAddr provides a mock function with given fields: ctx, ip 669 func (_m *API) UnblockAddr(ctx context.Context, ip net.IP) error { 670 ret := _m.Called(ctx, ip) 671 672 var r0 error 673 if rf, ok := ret.Get(0).(func(context.Context, net.IP) error); ok { 674 r0 = rf(ctx, ip) 675 } else { 676 r0 = ret.Error(0) 677 } 678 679 return r0 680 } 681 682 // API_UnblockAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnblockAddr' 683 type API_UnblockAddr_Call struct { 684 *mock.Call 685 } 686 687 // UnblockAddr is a helper method to define mock.On call 688 // - ctx context.Context 689 // - ip net.IP 690 func (_e *API_Expecter) UnblockAddr(ctx interface{}, ip interface{}) *API_UnblockAddr_Call { 691 return &API_UnblockAddr_Call{Call: _e.mock.On("UnblockAddr", ctx, ip)} 692 } 693 694 func (_c *API_UnblockAddr_Call) Run(run func(ctx context.Context, ip net.IP)) *API_UnblockAddr_Call { 695 _c.Call.Run(func(args mock.Arguments) { 696 run(args[0].(context.Context), args[1].(net.IP)) 697 }) 698 return _c 699 } 700 701 func (_c *API_UnblockAddr_Call) Return(_a0 error) *API_UnblockAddr_Call { 702 _c.Call.Return(_a0) 703 return _c 704 } 705 706 func (_c *API_UnblockAddr_Call) RunAndReturn(run func(context.Context, net.IP) error) *API_UnblockAddr_Call { 707 _c.Call.Return(run) 708 return _c 709 } 710 711 // UnblockPeer provides a mock function with given fields: ctx, p 712 func (_m *API) UnblockPeer(ctx context.Context, p peer.ID) error { 713 ret := _m.Called(ctx, p) 714 715 var r0 error 716 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) error); ok { 717 r0 = rf(ctx, p) 718 } else { 719 r0 = ret.Error(0) 720 } 721 722 return r0 723 } 724 725 // API_UnblockPeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnblockPeer' 726 type API_UnblockPeer_Call struct { 727 *mock.Call 728 } 729 730 // UnblockPeer is a helper method to define mock.On call 731 // - ctx context.Context 732 // - p peer.ID 733 func (_e *API_Expecter) UnblockPeer(ctx interface{}, p interface{}) *API_UnblockPeer_Call { 734 return &API_UnblockPeer_Call{Call: _e.mock.On("UnblockPeer", ctx, p)} 735 } 736 737 func (_c *API_UnblockPeer_Call) Run(run func(ctx context.Context, p peer.ID)) *API_UnblockPeer_Call { 738 _c.Call.Run(func(args mock.Arguments) { 739 run(args[0].(context.Context), args[1].(peer.ID)) 740 }) 741 return _c 742 } 743 744 func (_c *API_UnblockPeer_Call) Return(_a0 error) *API_UnblockPeer_Call { 745 _c.Call.Return(_a0) 746 return _c 747 } 748 749 func (_c *API_UnblockPeer_Call) RunAndReturn(run func(context.Context, peer.ID) error) *API_UnblockPeer_Call { 750 _c.Call.Return(run) 751 return _c 752 } 753 754 // UnblockSubnet provides a mock function with given fields: ctx, ipnet 755 func (_m *API) UnblockSubnet(ctx context.Context, ipnet *net.IPNet) error { 756 ret := _m.Called(ctx, ipnet) 757 758 var r0 error 759 if rf, ok := ret.Get(0).(func(context.Context, *net.IPNet) error); ok { 760 r0 = rf(ctx, ipnet) 761 } else { 762 r0 = ret.Error(0) 763 } 764 765 return r0 766 } 767 768 // API_UnblockSubnet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnblockSubnet' 769 type API_UnblockSubnet_Call struct { 770 *mock.Call 771 } 772 773 // UnblockSubnet is a helper method to define mock.On call 774 // - ctx context.Context 775 // - ipnet *net.IPNet 776 func (_e *API_Expecter) UnblockSubnet(ctx interface{}, ipnet interface{}) *API_UnblockSubnet_Call { 777 return &API_UnblockSubnet_Call{Call: _e.mock.On("UnblockSubnet", ctx, ipnet)} 778 } 779 780 func (_c *API_UnblockSubnet_Call) Run(run func(ctx context.Context, ipnet *net.IPNet)) *API_UnblockSubnet_Call { 781 _c.Call.Run(func(args mock.Arguments) { 782 run(args[0].(context.Context), args[1].(*net.IPNet)) 783 }) 784 return _c 785 } 786 787 func (_c *API_UnblockSubnet_Call) Return(_a0 error) *API_UnblockSubnet_Call { 788 _c.Call.Return(_a0) 789 return _c 790 } 791 792 func (_c *API_UnblockSubnet_Call) RunAndReturn(run func(context.Context, *net.IPNet) error) *API_UnblockSubnet_Call { 793 _c.Call.Return(run) 794 return _c 795 } 796 797 // UnprotectPeer provides a mock function with given fields: ctx, p 798 func (_m *API) UnprotectPeer(ctx context.Context, p peer.ID) error { 799 ret := _m.Called(ctx, p) 800 801 var r0 error 802 if rf, ok := ret.Get(0).(func(context.Context, peer.ID) error); ok { 803 r0 = rf(ctx, p) 804 } else { 805 r0 = ret.Error(0) 806 } 807 808 return r0 809 } 810 811 // API_UnprotectPeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnprotectPeer' 812 type API_UnprotectPeer_Call struct { 813 *mock.Call 814 } 815 816 // UnprotectPeer is a helper method to define mock.On call 817 // - ctx context.Context 818 // - p peer.ID 819 func (_e *API_Expecter) UnprotectPeer(ctx interface{}, p interface{}) *API_UnprotectPeer_Call { 820 return &API_UnprotectPeer_Call{Call: _e.mock.On("UnprotectPeer", ctx, p)} 821 } 822 823 func (_c *API_UnprotectPeer_Call) Run(run func(ctx context.Context, p peer.ID)) *API_UnprotectPeer_Call { 824 _c.Call.Run(func(args mock.Arguments) { 825 run(args[0].(context.Context), args[1].(peer.ID)) 826 }) 827 return _c 828 } 829 830 func (_c *API_UnprotectPeer_Call) Return(_a0 error) *API_UnprotectPeer_Call { 831 _c.Call.Return(_a0) 832 return _c 833 } 834 835 func (_c *API_UnprotectPeer_Call) RunAndReturn(run func(context.Context, peer.ID) error) *API_UnprotectPeer_Call { 836 _c.Call.Return(run) 837 return _c 838 } 839 840 type mockConstructorTestingTNewAPI interface { 841 mock.TestingT 842 Cleanup(func()) 843 } 844 845 // NewAPI creates a new instance of API. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 846 func NewAPI(t mockConstructorTestingTNewAPI) *API { 847 mock := &API{} 848 mock.Mock.Test(t) 849 850 t.Cleanup(func() { mock.AssertExpectations(t) }) 851 852 return mock 853 }