Skip to content

Remove models.Introducer and use introducer.Instead + refactoring

Pea Nut requested to merge fix-33 into main
  • Remove models package (had a second/redundant Introducer/Bridge struct)

    • the whole models directory was removed
    • instead we use introducer.Introducer and introducer.Bridge
  • in pkg/storage/storage.go

    • storage.AddIntroducer now get's an introducer as parameter (not an introducerURL as string)
      • storage.AddIntroducer verifies the introducer by calling intro.Validate() before saving it to disk
    • remove GetIntroducerByURL function - it's not needed
      • not fully sure but I think more url parsing was needed after changing to the "new" struct
  • in pkg/storage/storage_test.go

    • Remove TestAddIntroducerWithMissingFQDN: not needed any more, as we need to create a valid introducer before
    • same for TestAddIntroducerWithMissingURLScheme
    • Remove TestUpdateLastUsedForIntroducer
    • the rest in this file: we first need to create an introducer before using storage.AddIntroducer
  • Remove fields CreatedAt and LastUsed of the introducer struct

    • not needed anymore, as we only save a single introducer per fqdn)
    • remove store.UpdateLastUsedForIntroducer function
    • therefore: don't hook into successfull API calls to update LastUsed field
  • in pkg/mobile/bitmaskmobile.go rename introducer to intro because we also import a package called introducer

    • we call introducer.NewIntroducerFromURL in the same line

Merge request reports

Loading