In the code: https://github.com/syncthing/syncthing
I'm not going to do the implementation to figure out exactly which parts are the most annoying. This is something you're going to have to either accept on faith or figure out for yourself.
That became clear I rephrase therefore the question. Instead of pointing to the general syncthing repository, can you point me to that part of it you think the tricky one is to shorten my search. Would be nice. Thanks.
Look at the model package which handles all the stuff about sharing folders and connections and scanning and so on. Maybe model your attempt on the send-only folder as that is closest to what you need.