{"action":"created","issue":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/4085","repository_url":"https://api.github.com/repos/syncthing/syncthing","labels_url":"https://api.github.com/repos/syncthing/syncthing/issues/4085/labels{/name}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/4085/comments","events_url":"https://api.github.com/repos/syncthing/syncthing/issues/4085/events","html_url":"https://github.com/syncthing/syncthing/issues/4085","id":219847317,"node_id":"MDU6SXNzdWUyMTk4NDczMTc=","number":4085,"title":"Refactor out cmd/syncthing","user":{"login":"calmh","id":125426,"node_id":"MDQ6VXNlcjEyNTQyNg==","avatar_url":"https://avatars3.githubusercontent.com/u/125426?v=4","gravatar_id":"","url":"https://api.github.com/users/calmh","html_url":"https://github.com/calmh","followers_url":"https://api.github.com/users/calmh/followers","following_url":"https://api.github.com/users/calmh/following{/other_user}","gists_url":"https://api.github.com/users/calmh/gists{/gist_id}","starred_url":"https://api.github.com/users/calmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calmh/subscriptions","organizations_url":"https://api.github.com/users/calmh/orgs","repos_url":"https://api.github.com/users/calmh/repos","events_url":"https://api.github.com/users/calmh/events{/privacy}","received_events_url":"https://api.github.com/users/calmh/received_events","type":"User","site_admin":false},"labels":[{"id":67767667,"node_id":"MDU6TGFiZWw2Nzc2NzY2Nw==","url":"https://api.github.com/repos/syncthing/syncthing/labels/enhancement","name":"enhancement","color":"0e8a16","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-04-06T10:03:30Z","updated_at":"2019-07-17T16:17:08Z","closed_at":null,"author_association":"MEMBER","body":"Currently cmd/syncthing contains a shitload of stuff. This makes sense as is, but complicates reuse. What reuse? Possibilities:\r\n\r\n - libsyncthing.so which is actually loadable from C land and contains all the required functionality.\r\n - An actual GUI application written as above or in Go directly (using Qt bindings for example)\r\n - The current CLI/web application.\r\n\r\nIdeally cmd/syncthing would be the 100 or so lines required to parse environment variables and command line switches, maybe load the config, and then `app := application.New(&cfg); app.Run()` or something like that."},"comment":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/comments/512351134","html_url":"https://github.com/syncthing/syncthing/issues/4085#issuecomment-512351134","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/4085","id":512351134,"node_id":"MDEyOklzc3VlQ29tbWVudDUxMjM1MTEzNA==","user":{"login":"Martchus","id":10248953,"node_id":"MDQ6VXNlcjEwMjQ4OTUz","avatar_url":"https://avatars3.githubusercontent.com/u/10248953?v=4","gravatar_id":"","url":"https://api.github.com/users/Martchus","html_url":"https://github.com/Martchus","followers_url":"https://api.github.com/users/Martchus/followers","following_url":"https://api.github.com/users/Martchus/following{/other_user}","gists_url":"https://api.github.com/users/Martchus/gists{/gist_id}","starred_url":"https://api.github.com/users/Martchus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martchus/subscriptions","organizations_url":"https://api.github.com/users/Martchus/orgs","repos_url":"https://api.github.com/users/Martchus/repos","events_url":"https://api.github.com/users/Martchus/events{/privacy}","received_events_url":"https://api.github.com/users/Martchus/received_events","type":"User","site_admin":false},"created_at":"2019-07-17T16:17:08Z","updated_at":"2019-07-17T16:17:08Z","author_association":"NONE","body":"I based my basic C-bindings and integration into Syncthing Tray now on the latest master. It basically works and I didn't need to modify any files of Syncthing itself anymore. I only added my own files for the C-bindings but those could also be moved to my own repo now.\r\n\r\nSee  \r\n* https://github.com/Martchus/syncthingtray/commit/038225936eb0ec8d9515d2d0b0d3e375d219e894\r\n* https://github.com/Martchus/syncthing/commit/51440c77d846bbca1de48d58d6fc5ad69758ca7a\r\n\r\nI've noticed that there are still a few things in `main.go` which would be desirable to have in the library as well. Checkout `c_bindings.go` of my tiny C wrapper and you will spot the code I've just copied and pasted from `main.go`. That is of course not a good solution. I haven't copied over code for handling previous config file versions and cleaning up the config directory but that would be useful, too.\r\n\r\nStopping and starting again now also doesn't produce crashes anymore. It only seems that Syncthing isn't able to stop \"in a timely manner\":\r\n\r\n```\r\n[INFO]    syncthing unknown-dev \"Fermium Flea\" (go1.12.6 linux-amd64) unknown@unknown 1970-01-01 00:00:00 UTC\r\n[INFO]    My ID: H6NY7TD-3YFH6OK-G6X3YF7-HXZ7ORK-NG4THAL-TGTGZH6-YDO2XRM-HCZZZQ2\r\n[INFO]    Single thread SHA256 performance is 402 MB/s using minio/sha256-simd (342 MB/s using crypto/sha256).\r\n[INFO]    Hashing performance is 335.17 MB/s\r\n[INFO]    Starting deadlock detector with 20m0s timeout\r\n[INFO]    No stored folder metadata for \"default\": recalculating\r\n[INFO]    Ready to synchronize \"Default Folder\" (default) (sendreceive)\r\n[INFO]    Overall send rate is unlimited, receive rate is unlimited\r\n[INFO]    Using discovery server https://discovery.syncthing.net/v2/?noannounce&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW\r\n[INFO]    Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting\r\n[INFO]    Using discovery server https://discovery-v4.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW\r\n[INFO]    TCP listener ([::]:46099) starting\r\n[INFO]    Using discovery server https://discovery-v6.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW\r\n[INFO]    Completed initial scan of sendreceive folder \"Default Folder\" (default)\r\n[INFO]    Loading HTTPS certificate: open /hdd/build/qtcreator/build-syncthingtray-Desktop_Clang-Debug/syncthingtray/tray/libst/https-cert.pem: no such file or directory\r\n[INFO]    Creating new HTTPS certificate\r\n[INFO]    GUI and API listening on 127.0.0.1:41701\r\n[INFO]    Access the GUI via the following URL: http://127.0.0.1:41701/\r\n[INFO]    My name is \"linux-9lzf\"\r\n[INFO]    Sent usage report (version 3)\r\n[INFO]    Detected 1 NAT service\r\n[INFO]    Joined relay relay://147.175.187.143:993\r\n[INFO]    TCP listener ([::]:46099) shutting down\r\n[INFO]    c.S.listenerSupervisor: Service dynamic+https://relays.syncthing.net/endpoint failed to terminate in a timely manner\r\n[INFO]    connections.Service: Service c.S.listenerSupervisor failed to terminate in a timely manner\r\n[INFO]    Exiting\r\n\r\nSyncthing exited with exit code 0\r\n```\r\n\r\nBy the way, that log was copied from the text area in the launcher settings of Syncthing Tray. So the logging callback actually works fine and it isn't even much code: https://github.com/Martchus/syncthing/commit/51440c77d846bbca1de48d58d6fc5ad69758ca7a#diff-68f5a820655f0f2818ba4930885a8bf7R36"}}
{"actor":{"display_login":"Martchus"}}