connection_info.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. // Code generated by counterfeiter. DO NOT EDIT.
  2. package mocks
  3. import (
  4. "net"
  5. "sync"
  6. "time"
  7. "github.com/syncthing/syncthing/lib/protocol"
  8. )
  9. type ConnectionInfo struct {
  10. ConnectionIDStub func() string
  11. connectionIDMutex sync.RWMutex
  12. connectionIDArgsForCall []struct {
  13. }
  14. connectionIDReturns struct {
  15. result1 string
  16. }
  17. connectionIDReturnsOnCall map[int]struct {
  18. result1 string
  19. }
  20. CryptoStub func() string
  21. cryptoMutex sync.RWMutex
  22. cryptoArgsForCall []struct {
  23. }
  24. cryptoReturns struct {
  25. result1 string
  26. }
  27. cryptoReturnsOnCall map[int]struct {
  28. result1 string
  29. }
  30. EstablishedAtStub func() time.Time
  31. establishedAtMutex sync.RWMutex
  32. establishedAtArgsForCall []struct {
  33. }
  34. establishedAtReturns struct {
  35. result1 time.Time
  36. }
  37. establishedAtReturnsOnCall map[int]struct {
  38. result1 time.Time
  39. }
  40. IsLocalStub func() bool
  41. isLocalMutex sync.RWMutex
  42. isLocalArgsForCall []struct {
  43. }
  44. isLocalReturns struct {
  45. result1 bool
  46. }
  47. isLocalReturnsOnCall map[int]struct {
  48. result1 bool
  49. }
  50. PriorityStub func() int
  51. priorityMutex sync.RWMutex
  52. priorityArgsForCall []struct {
  53. }
  54. priorityReturns struct {
  55. result1 int
  56. }
  57. priorityReturnsOnCall map[int]struct {
  58. result1 int
  59. }
  60. RemoteAddrStub func() net.Addr
  61. remoteAddrMutex sync.RWMutex
  62. remoteAddrArgsForCall []struct {
  63. }
  64. remoteAddrReturns struct {
  65. result1 net.Addr
  66. }
  67. remoteAddrReturnsOnCall map[int]struct {
  68. result1 net.Addr
  69. }
  70. StringStub func() string
  71. stringMutex sync.RWMutex
  72. stringArgsForCall []struct {
  73. }
  74. stringReturns struct {
  75. result1 string
  76. }
  77. stringReturnsOnCall map[int]struct {
  78. result1 string
  79. }
  80. TransportStub func() string
  81. transportMutex sync.RWMutex
  82. transportArgsForCall []struct {
  83. }
  84. transportReturns struct {
  85. result1 string
  86. }
  87. transportReturnsOnCall map[int]struct {
  88. result1 string
  89. }
  90. TypeStub func() string
  91. typeMutex sync.RWMutex
  92. typeArgsForCall []struct {
  93. }
  94. typeReturns struct {
  95. result1 string
  96. }
  97. typeReturnsOnCall map[int]struct {
  98. result1 string
  99. }
  100. invocations map[string][][]interface{}
  101. invocationsMutex sync.RWMutex
  102. }
  103. func (fake *ConnectionInfo) ConnectionID() string {
  104. fake.connectionIDMutex.Lock()
  105. ret, specificReturn := fake.connectionIDReturnsOnCall[len(fake.connectionIDArgsForCall)]
  106. fake.connectionIDArgsForCall = append(fake.connectionIDArgsForCall, struct {
  107. }{})
  108. stub := fake.ConnectionIDStub
  109. fakeReturns := fake.connectionIDReturns
  110. fake.recordInvocation("ConnectionID", []interface{}{})
  111. fake.connectionIDMutex.Unlock()
  112. if stub != nil {
  113. return stub()
  114. }
  115. if specificReturn {
  116. return ret.result1
  117. }
  118. return fakeReturns.result1
  119. }
  120. func (fake *ConnectionInfo) ConnectionIDCallCount() int {
  121. fake.connectionIDMutex.RLock()
  122. defer fake.connectionIDMutex.RUnlock()
  123. return len(fake.connectionIDArgsForCall)
  124. }
  125. func (fake *ConnectionInfo) ConnectionIDCalls(stub func() string) {
  126. fake.connectionIDMutex.Lock()
  127. defer fake.connectionIDMutex.Unlock()
  128. fake.ConnectionIDStub = stub
  129. }
  130. func (fake *ConnectionInfo) ConnectionIDReturns(result1 string) {
  131. fake.connectionIDMutex.Lock()
  132. defer fake.connectionIDMutex.Unlock()
  133. fake.ConnectionIDStub = nil
  134. fake.connectionIDReturns = struct {
  135. result1 string
  136. }{result1}
  137. }
  138. func (fake *ConnectionInfo) ConnectionIDReturnsOnCall(i int, result1 string) {
  139. fake.connectionIDMutex.Lock()
  140. defer fake.connectionIDMutex.Unlock()
  141. fake.ConnectionIDStub = nil
  142. if fake.connectionIDReturnsOnCall == nil {
  143. fake.connectionIDReturnsOnCall = make(map[int]struct {
  144. result1 string
  145. })
  146. }
  147. fake.connectionIDReturnsOnCall[i] = struct {
  148. result1 string
  149. }{result1}
  150. }
  151. func (fake *ConnectionInfo) Crypto() string {
  152. fake.cryptoMutex.Lock()
  153. ret, specificReturn := fake.cryptoReturnsOnCall[len(fake.cryptoArgsForCall)]
  154. fake.cryptoArgsForCall = append(fake.cryptoArgsForCall, struct {
  155. }{})
  156. stub := fake.CryptoStub
  157. fakeReturns := fake.cryptoReturns
  158. fake.recordInvocation("Crypto", []interface{}{})
  159. fake.cryptoMutex.Unlock()
  160. if stub != nil {
  161. return stub()
  162. }
  163. if specificReturn {
  164. return ret.result1
  165. }
  166. return fakeReturns.result1
  167. }
  168. func (fake *ConnectionInfo) CryptoCallCount() int {
  169. fake.cryptoMutex.RLock()
  170. defer fake.cryptoMutex.RUnlock()
  171. return len(fake.cryptoArgsForCall)
  172. }
  173. func (fake *ConnectionInfo) CryptoCalls(stub func() string) {
  174. fake.cryptoMutex.Lock()
  175. defer fake.cryptoMutex.Unlock()
  176. fake.CryptoStub = stub
  177. }
  178. func (fake *ConnectionInfo) CryptoReturns(result1 string) {
  179. fake.cryptoMutex.Lock()
  180. defer fake.cryptoMutex.Unlock()
  181. fake.CryptoStub = nil
  182. fake.cryptoReturns = struct {
  183. result1 string
  184. }{result1}
  185. }
  186. func (fake *ConnectionInfo) CryptoReturnsOnCall(i int, result1 string) {
  187. fake.cryptoMutex.Lock()
  188. defer fake.cryptoMutex.Unlock()
  189. fake.CryptoStub = nil
  190. if fake.cryptoReturnsOnCall == nil {
  191. fake.cryptoReturnsOnCall = make(map[int]struct {
  192. result1 string
  193. })
  194. }
  195. fake.cryptoReturnsOnCall[i] = struct {
  196. result1 string
  197. }{result1}
  198. }
  199. func (fake *ConnectionInfo) EstablishedAt() time.Time {
  200. fake.establishedAtMutex.Lock()
  201. ret, specificReturn := fake.establishedAtReturnsOnCall[len(fake.establishedAtArgsForCall)]
  202. fake.establishedAtArgsForCall = append(fake.establishedAtArgsForCall, struct {
  203. }{})
  204. stub := fake.EstablishedAtStub
  205. fakeReturns := fake.establishedAtReturns
  206. fake.recordInvocation("EstablishedAt", []interface{}{})
  207. fake.establishedAtMutex.Unlock()
  208. if stub != nil {
  209. return stub()
  210. }
  211. if specificReturn {
  212. return ret.result1
  213. }
  214. return fakeReturns.result1
  215. }
  216. func (fake *ConnectionInfo) EstablishedAtCallCount() int {
  217. fake.establishedAtMutex.RLock()
  218. defer fake.establishedAtMutex.RUnlock()
  219. return len(fake.establishedAtArgsForCall)
  220. }
  221. func (fake *ConnectionInfo) EstablishedAtCalls(stub func() time.Time) {
  222. fake.establishedAtMutex.Lock()
  223. defer fake.establishedAtMutex.Unlock()
  224. fake.EstablishedAtStub = stub
  225. }
  226. func (fake *ConnectionInfo) EstablishedAtReturns(result1 time.Time) {
  227. fake.establishedAtMutex.Lock()
  228. defer fake.establishedAtMutex.Unlock()
  229. fake.EstablishedAtStub = nil
  230. fake.establishedAtReturns = struct {
  231. result1 time.Time
  232. }{result1}
  233. }
  234. func (fake *ConnectionInfo) EstablishedAtReturnsOnCall(i int, result1 time.Time) {
  235. fake.establishedAtMutex.Lock()
  236. defer fake.establishedAtMutex.Unlock()
  237. fake.EstablishedAtStub = nil
  238. if fake.establishedAtReturnsOnCall == nil {
  239. fake.establishedAtReturnsOnCall = make(map[int]struct {
  240. result1 time.Time
  241. })
  242. }
  243. fake.establishedAtReturnsOnCall[i] = struct {
  244. result1 time.Time
  245. }{result1}
  246. }
  247. func (fake *ConnectionInfo) IsLocal() bool {
  248. fake.isLocalMutex.Lock()
  249. ret, specificReturn := fake.isLocalReturnsOnCall[len(fake.isLocalArgsForCall)]
  250. fake.isLocalArgsForCall = append(fake.isLocalArgsForCall, struct {
  251. }{})
  252. stub := fake.IsLocalStub
  253. fakeReturns := fake.isLocalReturns
  254. fake.recordInvocation("IsLocal", []interface{}{})
  255. fake.isLocalMutex.Unlock()
  256. if stub != nil {
  257. return stub()
  258. }
  259. if specificReturn {
  260. return ret.result1
  261. }
  262. return fakeReturns.result1
  263. }
  264. func (fake *ConnectionInfo) IsLocalCallCount() int {
  265. fake.isLocalMutex.RLock()
  266. defer fake.isLocalMutex.RUnlock()
  267. return len(fake.isLocalArgsForCall)
  268. }
  269. func (fake *ConnectionInfo) IsLocalCalls(stub func() bool) {
  270. fake.isLocalMutex.Lock()
  271. defer fake.isLocalMutex.Unlock()
  272. fake.IsLocalStub = stub
  273. }
  274. func (fake *ConnectionInfo) IsLocalReturns(result1 bool) {
  275. fake.isLocalMutex.Lock()
  276. defer fake.isLocalMutex.Unlock()
  277. fake.IsLocalStub = nil
  278. fake.isLocalReturns = struct {
  279. result1 bool
  280. }{result1}
  281. }
  282. func (fake *ConnectionInfo) IsLocalReturnsOnCall(i int, result1 bool) {
  283. fake.isLocalMutex.Lock()
  284. defer fake.isLocalMutex.Unlock()
  285. fake.IsLocalStub = nil
  286. if fake.isLocalReturnsOnCall == nil {
  287. fake.isLocalReturnsOnCall = make(map[int]struct {
  288. result1 bool
  289. })
  290. }
  291. fake.isLocalReturnsOnCall[i] = struct {
  292. result1 bool
  293. }{result1}
  294. }
  295. func (fake *ConnectionInfo) Priority() int {
  296. fake.priorityMutex.Lock()
  297. ret, specificReturn := fake.priorityReturnsOnCall[len(fake.priorityArgsForCall)]
  298. fake.priorityArgsForCall = append(fake.priorityArgsForCall, struct {
  299. }{})
  300. stub := fake.PriorityStub
  301. fakeReturns := fake.priorityReturns
  302. fake.recordInvocation("Priority", []interface{}{})
  303. fake.priorityMutex.Unlock()
  304. if stub != nil {
  305. return stub()
  306. }
  307. if specificReturn {
  308. return ret.result1
  309. }
  310. return fakeReturns.result1
  311. }
  312. func (fake *ConnectionInfo) PriorityCallCount() int {
  313. fake.priorityMutex.RLock()
  314. defer fake.priorityMutex.RUnlock()
  315. return len(fake.priorityArgsForCall)
  316. }
  317. func (fake *ConnectionInfo) PriorityCalls(stub func() int) {
  318. fake.priorityMutex.Lock()
  319. defer fake.priorityMutex.Unlock()
  320. fake.PriorityStub = stub
  321. }
  322. func (fake *ConnectionInfo) PriorityReturns(result1 int) {
  323. fake.priorityMutex.Lock()
  324. defer fake.priorityMutex.Unlock()
  325. fake.PriorityStub = nil
  326. fake.priorityReturns = struct {
  327. result1 int
  328. }{result1}
  329. }
  330. func (fake *ConnectionInfo) PriorityReturnsOnCall(i int, result1 int) {
  331. fake.priorityMutex.Lock()
  332. defer fake.priorityMutex.Unlock()
  333. fake.PriorityStub = nil
  334. if fake.priorityReturnsOnCall == nil {
  335. fake.priorityReturnsOnCall = make(map[int]struct {
  336. result1 int
  337. })
  338. }
  339. fake.priorityReturnsOnCall[i] = struct {
  340. result1 int
  341. }{result1}
  342. }
  343. func (fake *ConnectionInfo) RemoteAddr() net.Addr {
  344. fake.remoteAddrMutex.Lock()
  345. ret, specificReturn := fake.remoteAddrReturnsOnCall[len(fake.remoteAddrArgsForCall)]
  346. fake.remoteAddrArgsForCall = append(fake.remoteAddrArgsForCall, struct {
  347. }{})
  348. stub := fake.RemoteAddrStub
  349. fakeReturns := fake.remoteAddrReturns
  350. fake.recordInvocation("RemoteAddr", []interface{}{})
  351. fake.remoteAddrMutex.Unlock()
  352. if stub != nil {
  353. return stub()
  354. }
  355. if specificReturn {
  356. return ret.result1
  357. }
  358. return fakeReturns.result1
  359. }
  360. func (fake *ConnectionInfo) RemoteAddrCallCount() int {
  361. fake.remoteAddrMutex.RLock()
  362. defer fake.remoteAddrMutex.RUnlock()
  363. return len(fake.remoteAddrArgsForCall)
  364. }
  365. func (fake *ConnectionInfo) RemoteAddrCalls(stub func() net.Addr) {
  366. fake.remoteAddrMutex.Lock()
  367. defer fake.remoteAddrMutex.Unlock()
  368. fake.RemoteAddrStub = stub
  369. }
  370. func (fake *ConnectionInfo) RemoteAddrReturns(result1 net.Addr) {
  371. fake.remoteAddrMutex.Lock()
  372. defer fake.remoteAddrMutex.Unlock()
  373. fake.RemoteAddrStub = nil
  374. fake.remoteAddrReturns = struct {
  375. result1 net.Addr
  376. }{result1}
  377. }
  378. func (fake *ConnectionInfo) RemoteAddrReturnsOnCall(i int, result1 net.Addr) {
  379. fake.remoteAddrMutex.Lock()
  380. defer fake.remoteAddrMutex.Unlock()
  381. fake.RemoteAddrStub = nil
  382. if fake.remoteAddrReturnsOnCall == nil {
  383. fake.remoteAddrReturnsOnCall = make(map[int]struct {
  384. result1 net.Addr
  385. })
  386. }
  387. fake.remoteAddrReturnsOnCall[i] = struct {
  388. result1 net.Addr
  389. }{result1}
  390. }
  391. func (fake *ConnectionInfo) String() string {
  392. fake.stringMutex.Lock()
  393. ret, specificReturn := fake.stringReturnsOnCall[len(fake.stringArgsForCall)]
  394. fake.stringArgsForCall = append(fake.stringArgsForCall, struct {
  395. }{})
  396. stub := fake.StringStub
  397. fakeReturns := fake.stringReturns
  398. fake.recordInvocation("String", []interface{}{})
  399. fake.stringMutex.Unlock()
  400. if stub != nil {
  401. return stub()
  402. }
  403. if specificReturn {
  404. return ret.result1
  405. }
  406. return fakeReturns.result1
  407. }
  408. func (fake *ConnectionInfo) StringCallCount() int {
  409. fake.stringMutex.RLock()
  410. defer fake.stringMutex.RUnlock()
  411. return len(fake.stringArgsForCall)
  412. }
  413. func (fake *ConnectionInfo) StringCalls(stub func() string) {
  414. fake.stringMutex.Lock()
  415. defer fake.stringMutex.Unlock()
  416. fake.StringStub = stub
  417. }
  418. func (fake *ConnectionInfo) StringReturns(result1 string) {
  419. fake.stringMutex.Lock()
  420. defer fake.stringMutex.Unlock()
  421. fake.StringStub = nil
  422. fake.stringReturns = struct {
  423. result1 string
  424. }{result1}
  425. }
  426. func (fake *ConnectionInfo) StringReturnsOnCall(i int, result1 string) {
  427. fake.stringMutex.Lock()
  428. defer fake.stringMutex.Unlock()
  429. fake.StringStub = nil
  430. if fake.stringReturnsOnCall == nil {
  431. fake.stringReturnsOnCall = make(map[int]struct {
  432. result1 string
  433. })
  434. }
  435. fake.stringReturnsOnCall[i] = struct {
  436. result1 string
  437. }{result1}
  438. }
  439. func (fake *ConnectionInfo) Transport() string {
  440. fake.transportMutex.Lock()
  441. ret, specificReturn := fake.transportReturnsOnCall[len(fake.transportArgsForCall)]
  442. fake.transportArgsForCall = append(fake.transportArgsForCall, struct {
  443. }{})
  444. stub := fake.TransportStub
  445. fakeReturns := fake.transportReturns
  446. fake.recordInvocation("Transport", []interface{}{})
  447. fake.transportMutex.Unlock()
  448. if stub != nil {
  449. return stub()
  450. }
  451. if specificReturn {
  452. return ret.result1
  453. }
  454. return fakeReturns.result1
  455. }
  456. func (fake *ConnectionInfo) TransportCallCount() int {
  457. fake.transportMutex.RLock()
  458. defer fake.transportMutex.RUnlock()
  459. return len(fake.transportArgsForCall)
  460. }
  461. func (fake *ConnectionInfo) TransportCalls(stub func() string) {
  462. fake.transportMutex.Lock()
  463. defer fake.transportMutex.Unlock()
  464. fake.TransportStub = stub
  465. }
  466. func (fake *ConnectionInfo) TransportReturns(result1 string) {
  467. fake.transportMutex.Lock()
  468. defer fake.transportMutex.Unlock()
  469. fake.TransportStub = nil
  470. fake.transportReturns = struct {
  471. result1 string
  472. }{result1}
  473. }
  474. func (fake *ConnectionInfo) TransportReturnsOnCall(i int, result1 string) {
  475. fake.transportMutex.Lock()
  476. defer fake.transportMutex.Unlock()
  477. fake.TransportStub = nil
  478. if fake.transportReturnsOnCall == nil {
  479. fake.transportReturnsOnCall = make(map[int]struct {
  480. result1 string
  481. })
  482. }
  483. fake.transportReturnsOnCall[i] = struct {
  484. result1 string
  485. }{result1}
  486. }
  487. func (fake *ConnectionInfo) Type() string {
  488. fake.typeMutex.Lock()
  489. ret, specificReturn := fake.typeReturnsOnCall[len(fake.typeArgsForCall)]
  490. fake.typeArgsForCall = append(fake.typeArgsForCall, struct {
  491. }{})
  492. stub := fake.TypeStub
  493. fakeReturns := fake.typeReturns
  494. fake.recordInvocation("Type", []interface{}{})
  495. fake.typeMutex.Unlock()
  496. if stub != nil {
  497. return stub()
  498. }
  499. if specificReturn {
  500. return ret.result1
  501. }
  502. return fakeReturns.result1
  503. }
  504. func (fake *ConnectionInfo) TypeCallCount() int {
  505. fake.typeMutex.RLock()
  506. defer fake.typeMutex.RUnlock()
  507. return len(fake.typeArgsForCall)
  508. }
  509. func (fake *ConnectionInfo) TypeCalls(stub func() string) {
  510. fake.typeMutex.Lock()
  511. defer fake.typeMutex.Unlock()
  512. fake.TypeStub = stub
  513. }
  514. func (fake *ConnectionInfo) TypeReturns(result1 string) {
  515. fake.typeMutex.Lock()
  516. defer fake.typeMutex.Unlock()
  517. fake.TypeStub = nil
  518. fake.typeReturns = struct {
  519. result1 string
  520. }{result1}
  521. }
  522. func (fake *ConnectionInfo) TypeReturnsOnCall(i int, result1 string) {
  523. fake.typeMutex.Lock()
  524. defer fake.typeMutex.Unlock()
  525. fake.TypeStub = nil
  526. if fake.typeReturnsOnCall == nil {
  527. fake.typeReturnsOnCall = make(map[int]struct {
  528. result1 string
  529. })
  530. }
  531. fake.typeReturnsOnCall[i] = struct {
  532. result1 string
  533. }{result1}
  534. }
  535. func (fake *ConnectionInfo) Invocations() map[string][][]interface{} {
  536. fake.invocationsMutex.RLock()
  537. defer fake.invocationsMutex.RUnlock()
  538. fake.connectionIDMutex.RLock()
  539. defer fake.connectionIDMutex.RUnlock()
  540. fake.cryptoMutex.RLock()
  541. defer fake.cryptoMutex.RUnlock()
  542. fake.establishedAtMutex.RLock()
  543. defer fake.establishedAtMutex.RUnlock()
  544. fake.isLocalMutex.RLock()
  545. defer fake.isLocalMutex.RUnlock()
  546. fake.priorityMutex.RLock()
  547. defer fake.priorityMutex.RUnlock()
  548. fake.remoteAddrMutex.RLock()
  549. defer fake.remoteAddrMutex.RUnlock()
  550. fake.stringMutex.RLock()
  551. defer fake.stringMutex.RUnlock()
  552. fake.transportMutex.RLock()
  553. defer fake.transportMutex.RUnlock()
  554. fake.typeMutex.RLock()
  555. defer fake.typeMutex.RUnlock()
  556. copiedInvocations := map[string][][]interface{}{}
  557. for key, value := range fake.invocations {
  558. copiedInvocations[key] = value
  559. }
  560. return copiedInvocations
  561. }
  562. func (fake *ConnectionInfo) recordInvocation(key string, args []interface{}) {
  563. fake.invocationsMutex.Lock()
  564. defer fake.invocationsMutex.Unlock()
  565. if fake.invocations == nil {
  566. fake.invocations = map[string][][]interface{}{}
  567. }
  568. if fake.invocations[key] == nil {
  569. fake.invocations[key] = [][]interface{}{}
  570. }
  571. fake.invocations[key] = append(fake.invocations[key], args)
  572. }
  573. var _ protocol.ConnectionInfo = new(ConnectionInfo)