Compare commits

..
225 Commits
Author SHA1 Message Date
Cameron Gutman ddd86d91eb Update GSv6Fwd to 2.6r2 2023-08-26 00:54:15 -05:00
Cameron Gutman 546e30f363 Version 5.6.1 2023-08-26 00:04:30 -05:00
Cameron Gutman 432c2e226c Monitor for name changes too to detect deletion of the NvStream subkey 2023-08-25 23:33:54 -05:00
Cameron Gutman cc98c2cd17 Version 5.6 2023-05-27 22:34:23 -05:00
Cameron Gutman c8a5fe2efa Update VCRedist 2023-05-27 22:27:41 -05:00
Cameron Gutman 6d5d83d420 Avoid deleting Sunshine's UPnP port mappings 2023-05-27 22:26:08 -05:00
Cameron Gutman 1e1d347052 Add limited support for testing Sunshine 2023-05-27 22:18:31 -05:00
Cameron Gutman 307623914b Update VCRedist 2022-08-09 20:28:40 -05:00
Cameron Gutman 8f011440b4 Redirect stdout to NUL if the log file can't be opened 2022-04-16 21:28:28 -05:00
Cameron Gutman 771e34f199 Revert "Don't crash if the log file can't be opened"
We don't have a stdout to _dup2() into when run as a service.

This reverts commit e9ddf91157.
2022-04-16 21:27:11 -05:00
Cameron Gutman c8e8af7d4b Version 5.5.4 2022-04-16 13:32:35 -05:00
Cameron Gutman 18b914d9f6 Update MiniUPnP and libnatpmp
MiniUPnP  -> 689d1fd
libnatpmp -> 724dc69
2022-04-16 13:30:13 -05:00
Cameron Gutman e9ddf91157 Don't crash if the log file can't be opened 2022-04-16 12:47:33 -05:00
Cameron Gutman 28a5935ee7 Get rid of NL macro 2022-04-16 11:56:26 -05:00
Cameron Gutman ce3b9c3d31 Update Visual C++ Runtime 2022-04-16 11:56:07 -05:00
Cameron Gutman 0f3506a92c Update toolset to VS 2022 2022-04-16 11:39:16 -05:00
Cameron Gutman 1e6337b9b0 Update Visual C++ Runtime installer 2021-08-15 12:30:21 -05:00
Cameron Gutman 363b62f69f Version 5.5.3 2021-03-06 13:12:09 -06:00
Cameron Gutman 3175b1c4fa Update VCRedist version for VC 16.9 2021-03-06 13:09:09 -06:00
Cameron Gutman 404af38d10 Version 5.5.2 2021-02-02 18:16:27 -06:00
Cameron Gutman dd72f65ffb Fix inaccurate test results on IPv6 when a temporary address is in use and no pinholes are created for it 2021-02-01 19:59:41 -06:00
Cameron Gutman 6589dc4853 Update GSv6Fwd with CET and CFG 2021-02-01 19:53:52 -06:00
Cameron Gutman 9772139229 Print UPnP root desc URL in logs 2021-02-01 19:41:14 -06:00
Cameron Gutman 03c89e4022 Update MiniUPnPc to 36cc66edda92093b24e051e38bd16a64900272e9
Built with CFG and CET enabled
2021-02-01 19:40:44 -06:00
Cameron Gutman d1fe5f6a9b Rebuilt libnatpmp with CET and CFG
Commit 4536032ae32268a45c073a4d5e91bbab4534773a
2021-02-01 19:40:24 -06:00
Cameron Gutman a88b8d0d04 Enable CFG and CET for MISS and MIST 2021-02-01 19:26:14 -06:00
Cameron Gutman fa5ae73abb Version 5.5.1 2020-11-29 23:38:14 -06:00
Cameron Gutman 4d197cae02 Improve performance and reliability when stopping MISS 2020-11-29 22:25:27 -06:00
Cameron Gutman 624af65b55 Fix minor installer build warnings 2020-11-29 22:06:02 -06:00
Cameron Gutman 6b1a0856cc Update miniupnpc to ba130320f4180f8f9a54c48c0634e0ea0118fa38
This adds DLL version resources for Windows Installer
2020-11-29 22:05:43 -06:00
Cameron Gutman 01a1012e74 Use preprocessor variables to improve readability 2020-11-29 20:21:37 -06:00
Cameron Gutman 66b36684ec Only download the CRT redistributable if it's newer than what is installed 2020-11-29 17:23:48 -06:00
Cameron Gutman e7db5242c9 Update installer for new DLLs 2020-11-29 15:58:20 -06:00
Cameron Gutman 5e09217af4 Update GSv6Fwd to use DLLs instead of static build 2020-11-29 15:57:10 -06:00
Cameron Gutman c21a64c874 Remove x64 solution target 2020-11-29 14:51:56 -06:00
Cameron Gutman ebe91d6799 Update project build files for the new DLLs 2020-11-29 14:51:41 -06:00
Cameron Gutman 077c9814e0 Sign pre-built libraries 2020-11-29 14:49:37 -06:00
Cameron Gutman 393dfb70a7 Update miniupnpc to 677e0db63649ad2aeb536783eb745c651f2fd5c2
Rebuild as DLL to prevent MSVC version incompatibility
2020-11-29 14:35:02 -06:00
Cameron Gutman 88fb77083f Update libnatpmp to 4536032ae32268a45c073a4d5e91bbab4534773a
Rebuild as a DLL to prevent MSVC version compatibility issues
2020-11-29 14:27:53 -06:00
Cameron Gutman 38514d08c1 Version 5.5 2020-10-10 13:58:23 -05:00
Cameron Gutman 5d75b11a35 Fix success text typos 2020-10-10 13:56:10 -05:00
Cameron Gutman f511b830ea Handle deletion of the 'HKLM\Software\NVIDIA Corporation' key 2020-10-10 13:35:05 -05:00
Cameron Gutman 8a45ea2066 Test for MTU problems 2020-10-10 12:39:48 -05:00
Cameron Gutman 3844ea59de Allow mDNS traffic through the firewall for autodiscovery 2020-10-10 12:07:42 -05:00
Cameron Gutman a19b95f259 RFC6887 says PCP max packet size is 1100 bytes 2020-10-10 12:00:48 -05:00
Cameron Gutman ae81d4305d Improve success message with more information 2020-10-10 11:57:26 -05:00
Cameron Gutman 8066cf4be1 Avoid extra GameStream state prints when the state isn't changing 2020-10-10 11:37:42 -05:00
Cameron Gutman 021474cdd2 Version 5.4 2020-09-07 11:15:52 -07:00
Cameron Gutman 308cd0dd00 Use dynamically allocated buffer for GetAdaptersAddresses() 2020-09-07 10:14:54 -07:00
Cameron Gutman 83360d775b Ignore ICMP Port Unreachable messages during STUN 2020-09-06 15:12:16 -07:00
Cameron Gutman cdbaa0aff3 Version 5.3.1 2020-08-30 13:47:35 -07:00
Cameron Gutman 36ea86faaa Configure SCM to restart our service if it crashes 2020-08-29 22:43:41 -07:00
Cameron Gutman 8590a0813b Stop testing after the first IPv6 relay server 2020-08-28 18:46:56 -07:00
Cameron Gutman 51ae1c8770 Fix socket errors being clobbered by closesocket() 2020-08-28 18:46:36 -07:00
Cameron Gutman f1ca6a71f0 Version 5.3 2020-08-14 18:35:19 -07:00
Cameron Gutman ac92212464 Fix flip-flopped HTTP and HTTPS rule IDs 2020-08-14 17:57:45 -07:00
Cameron Gutman dbf43ac7a1 Don't attempt to relocate WoL port 9 2020-08-14 17:54:48 -07:00
Cameron Gutman 893aa76c9c Replace hardcoded constant with #define 2020-08-14 17:52:59 -07:00
Cameron Gutman 21d8c71a2c Log the internal port for the UPnP mappings 2020-08-14 17:51:06 -07:00
Cameron Gutman 41ef072c9b Validate the port number of loopback traffic 2020-08-14 17:48:55 -07:00
Cameron Gutman 53246bd4c5 Don't redirect stdout for standalone exe invocation 2020-08-14 17:48:14 -07:00
Cameron Gutman ac850e79d8 Add firewall rules for GameStream just in case GFE didn't 2020-08-12 20:54:34 -07:00
Cameron Gutman 944c8993e8 Elevate priorities for the UDP relay threads 2020-08-11 01:12:48 -07:00
Cameron Gutman b6508d9024 Remove superfluous select() call 2020-08-11 00:59:13 -07:00
Cameron Gutman ef5bb72d5c Version 5.2 2020-08-10 22:05:43 -07:00
Cameron Gutman 3343ebb225 Don't allow testing while a stream is active 2020-08-10 21:50:52 -07:00
Cameron Gutman 05413a554c Work around IGDs that deduplicate entries based on the internal port
This is a violation of the UPnP IGD specification but we can relay through an alternate port as a workaround.
2020-08-10 21:16:21 -07:00
Cameron Gutman 5f015acdaa Improve robustness for broken UPnP IGDs 2020-08-09 16:01:39 -07:00
Cameron Gutman df286ef56d Use indefinite mappings if the IGD returns unexpected error codes 2020-08-09 15:30:48 -07:00
Cameron Gutman 47d60b9f24 Leave permanent mappings alone during the update cycle 2020-08-09 15:16:05 -07:00
Cameron Gutman 659d3aea23 Open UDP 47009 for WoL
It may work where UDP 9 fails because it's an unprivileged port
2020-08-09 14:00:14 -07:00
Cameron Gutman e4a4d42ece Version 5.1 2020-08-08 16:57:06 -07:00
Cameron Gutman 189e861362 Fix systems where Windows Firewall has been improperly disabled 2020-08-08 16:37:38 -07:00
Cameron Gutman fd022b67d3 Only test on the first reachable IPv4 and IPv6 relay servers 2020-08-07 21:58:36 -07:00
Cameron Gutman 14d27b4cf5 Use WinHTTP timeouts to avoid having to test HTTP ports twice 2020-08-04 02:03:14 -07:00
Cameron Gutman 17cb084968 Improve heuristic for distinguishing CGN vs double-NAT 2020-08-04 01:13:21 -07:00
Cameron Gutman ad8ef228d5 Fix double-close of connection handle on failure 2020-07-19 10:08:26 -07:00
Cameron Gutman 8d2252c4ac Version 5.0 2020-07-18 17:59:54 -07:00
Cameron Gutman 365b3ccd61 Remove redundant print 2020-07-18 17:55:45 -07:00
Cameron Gutman 74140a8511 Switch to the new loopback server protocol 2020-07-18 17:12:35 -07:00
Cameron Gutman a9bf4ffd70 Always run the loopback server test
It appears that in rare cases NAT reflection can work where real WAN traffic fails
2020-07-18 16:13:56 -07:00
Cameron Gutman 164d8b5467 Fix testing on Windows 7 with GFE 3.20.4 2020-07-18 15:53:47 -07:00
Cameron Gutman f1ebefa59c Add missing success print 2020-07-18 15:53:08 -07:00
Cameron Gutman 3e060fae54 Add supportedOS entries to the embedded manifest 2020-07-18 15:47:39 -07:00
Cameron Gutman f97c04a8cc Switch to WinHTTP instead of WinInet for HTTP testing 2020-07-18 13:27:52 -07:00
Cameron Gutman 85cd20005c Pass the port number directly rather than "https" to getaddrinfo()
Apparently, the services file in drivers\etc can be deleted and GFE still works.
2020-04-10 17:40:30 -07:00
Cameron Gutman e3e4bf608f Version 4.4 2020-02-21 18:03:38 -08:00
Cameron Gutman 0be2ca51e9 Send firewall/AV help to Known app compat issues section 2020-02-21 17:43:35 -08:00
Cameron Gutman 3e1ffce16f Add a check for blocked LAN access 2020-02-21 17:33:06 -08:00
Cameron Gutman c7813a7a0b Add specific help text for power option warnings and RDP error 2020-02-21 16:49:28 -08:00
Cameron Gutman 87fd3ad8e2 Check sleep and hibernation settings 2020-02-21 16:48:22 -08:00
Cameron Gutman 9d3ef0a215 Update miniupnpc to 44366328661826603982d1e0d7ebb4062c5f2bfc 2020-02-21 16:05:26 -08:00
Cameron Gutman ae83853a27 Rebuild libnatpmp with VC v16.4.5 2020-02-21 16:04:49 -08:00
Cameron Gutman 0b8b117cb2 Remove unused variables 2020-02-21 15:53:36 -08:00
Cameron Gutman 0050566124 Add a note to attempt restarting your router if UPnP is not detected 2020-02-21 15:52:21 -08:00
Cameron Gutman cc24472193 Add a check for a screen lock due to RDP 2020-02-21 15:51:51 -08:00
Cameron Gutman 4a11ab0f7f Fix firewall detection warning on non-English systems 2019-09-28 20:28:10 -07:00
Cameron Gutman c1c16edf7d Increase STUN retry limit 2019-09-28 20:26:01 -07:00
Cameron Gutman ae2647f36e Fix false firewall warning on Server SKUs 2019-09-28 16:36:40 -07:00
Cameron Gutman 8e40ef80bd Version 4.3 2019-09-28 16:27:25 -07:00
Cameron Gutman 16bb727b99 Update GS-IPv6-Forwarder to 2.3.1 2019-09-28 16:27:14 -07:00
Cameron Gutman 9194b8e22b Detect AV and firewall software that could interfere with GameStream 2019-09-28 16:06:03 -07:00
Cameron Gutman 2805464e86 Detect multiple connections to the same network 2019-09-28 15:24:53 -07:00
Cameron Gutman 20e7374480 Remove privilege restrictions due to app compat issues 2019-09-28 14:17:36 -07:00
Cameron Gutman 0fdbee831b Revert to an unrestricted service SID to address some app-compat issues with 3rd party Winsock providers 2019-09-28 14:11:32 -07:00
Cameron Gutman b37b99e9c3 Remove the "buggy router" warning that was actually caused by a libnatpmp bug 2019-09-28 14:03:32 -07:00
Cameron Gutman 29bbdc5319 Update libnatpmp to cgutman/libnatpmp eca208e3df44072d71bf3cd61753b4e77e1ddab0 2019-09-28 14:02:41 -07:00
Cameron Gutman 09cd50b12a Version 4.2 2019-08-08 01:34:09 -07:00
Cameron Gutman d60eda6fa8 Update GS IPv6 Forwarder for release 2019-08-08 01:33:45 -07:00
Cameron Gutman cda9bc6be7 Add support for testing ZeroTier configurations 2019-08-08 01:31:09 -07:00
Cameron Gutman 0008fbbcdb Try all resolved STUN servers 2019-08-08 00:02:53 -07:00
Cameron Gutman 620aa4b6d1 Version 4.1 2019-07-30 22:20:01 -07:00
Cameron Gutman b93ef55b65 Fix displaying broken ports when running IPv6-only 2019-07-30 22:12:45 -07:00
Cameron Gutman fdb033f550 Reduce wait time for UDP to offset retransmission delays 2019-07-30 21:48:48 -07:00
Cameron Gutman efdcaed4c1 Don't proceed after WSAEADDRINUSE for the loopback relay to avoid false positives 2019-07-30 21:47:29 -07:00
Cameron Gutman 5a2edb9a36 Add note about log for Discord 2019-07-30 21:45:26 -07:00
Cameron Gutman 798be5fd0a Implement heuristics for falling through to v4 detection even with working v6 2019-07-30 21:31:28 -07:00
Cameron Gutman b0941fee90 Update README.md 2019-07-29 22:54:53 -07:00
Cameron Gutman ebc7703bf2 Update error message text 2019-07-29 22:02:27 -07:00
Cameron Gutman bbf16383f5 Fix uninitialized sin_family field returned from CheckWANAccess() 2019-07-29 21:59:18 -07:00
Cameron Gutman dee2daac5a Fix invalid free on getaddrinfo() failure 2019-07-29 21:58:16 -07:00
Cameron Gutman 51e953c092 Test using the relay even if we believe it may be a double-NAT configuration 2019-07-29 21:25:40 -07:00
Cameron Gutman acb3f5a059 Add support for IPv6-only environments 2019-07-29 21:20:30 -07:00
Cameron Gutman 0bd212e6f1 Fix addrinfo leak 2019-07-29 21:06:18 -07:00
Cameron Gutman d076f881eb Print dialog text to the console 2019-07-29 21:04:17 -07:00
Cameron Gutman 46c2236342 Add support for getting local IPv6 address 2019-07-29 21:01:55 -07:00
Cameron Gutman 8158c85a23 Add support for IPv6 testing 2019-07-28 18:33:33 -07:00
Cameron Gutman 6f3898e4b4 Untabify source 2019-07-28 13:25:51 -07:00
Cameron Gutman b1a1352bbf Retransmit UDP test packets a few times to be safe 2019-07-28 13:16:22 -07:00
Cameron Gutman 069b0c7656 Add more periodic test output to avoid looking like the test is hung 2019-07-28 13:11:04 -07:00
Cameron Gutman 42df15c567 Switch stderr and stdout to prevent miniupnp warnings from appearing on the console 2019-07-28 13:09:48 -07:00
Cameron Gutman 96a88b55db Prepare to swap stdout and stderr for console output 2019-07-28 12:46:45 -07:00
Cameron Gutman 2d31cd0420 Rename Internet Streaming Helper to Internet Hosting Tool 2019-07-28 12:33:05 -07:00
Cameron Gutman ebb8c9fb68 Version 4.0 2019-07-13 15:21:23 -07:00
Cameron Gutman b31d257566 Integrate GSv6Fwd into MISH 2019-07-13 15:04:20 -07:00
Cameron Gutman 51dc3142ca Retarget to VS2019 2019-07-13 11:29:55 -07:00
Cameron Gutman c8ab32812f Version 3.0 2019-04-05 01:42:05 -07:00
Cameron Gutman 21802eac19 Improve messages to be less confusing 2019-04-05 01:41:55 -07:00
Cameron Gutman dab033ee3b Avoid testing UDP 48002 and UDP 48010 since they are currently unused 2019-04-05 00:39:51 -07:00
Cameron Gutman 204dde8a73 Avoid attempting to delete UPnP rules if the description doesn't match 2019-04-05 00:39:27 -07:00
Cameron Gutman 3d9e14fb56 Use a loopback relay if NAT reflection is unavailable 2019-04-05 00:38:47 -07:00
Cameron Gutman 771e09973f Print both old and new MISS logs 2019-03-28 19:46:34 -07:00
Cameron Gutman 1bc6cc5634 Fix log rotation 2019-03-28 19:42:09 -07:00
Cameron Gutman 0941cc5bc1 Set additional version attributes 2019-03-28 19:41:14 -07:00
Cameron Gutman a7e41d15f5 Add UTC time prefix to logs 2019-03-28 19:37:46 -07:00
Cameron Gutman 6916cfd0de Version 2.3 2019-03-09 16:03:46 -08:00
Cameron Gutman bae92c6c95 Allow the service access to its log folder 2019-03-09 16:00:10 -08:00
Cameron Gutman c8de19a3b6 Reduce service permissions 2019-03-09 15:02:14 -08:00
Cameron Gutman 1da8f371aa Update miniupnpc build to 4912dc37e30927eefd5d7bf0778d77172ef94803 2019-03-09 15:01:21 -08:00
Cameron Gutman cb55a02599 Fix parsing XOR-MAPPED-ADDRESS if the optional comprehension bit is set 2019-01-22 17:42:09 -08:00
Cameron Gutman dc820bdbf6 Version 2.2 2019-01-04 23:08:44 -08:00
Cameron Gutman 106960cbb5 Check for null help URL 2019-01-04 23:06:37 -08:00
Cameron Gutman 3c92a79fe2 Fix parsing bug handling empty SSDP headers 2019-01-04 23:02:07 -08:00
Cameron Gutman 2c2f275c3d Add help button to error dialogs 2019-01-04 22:49:02 -08:00
Cameron Gutman 156940cc5b Retry STUN over TCP on UDP failure 2019-01-04 20:46:48 -08:00
Cameron Gutman a835cf43a5 Require STUN public IP address to proceed with testing 2019-01-04 20:39:20 -08:00
Cameron Gutman 18b704b85a Use moonlight-stream.org instead of google.com to avoid issues in China 2019-01-04 19:22:46 -08:00
Cameron Gutman cd4adae22b Use stun.moonlight-stream.org for STUN 2019-01-04 19:17:31 -08:00
Cameron Gutman ef59e2858b Fix incorrect error message on STUN receive timeout 2018-11-30 00:33:48 -08:00
Cameron Gutman 218c0d7385 Increase SSDP UDP socket recv buffer size 2018-11-30 00:32:57 -08:00
Cameron Gutman e7f03cfa93 Add missing check for PCP version 2018-11-29 23:57:14 -08:00
Cameron Gutman f3a06e5379 Version 2.1 2018-11-20 18:10:38 -08:00
Cameron Gutman c7565256b5 Add support for PCP on the first hop 2018-11-20 18:09:28 -08:00
Cameron Gutman 5840e39e94 Improve message box text 2018-11-20 17:33:34 -08:00
Cameron Gutman 2ce09f5fea Assume that NAT-PMP rules are present if we found a NAT-PMP gateway 2018-11-20 17:30:11 -08:00
Cameron Gutman de806ad57e Add simple installer UI and license 2018-11-20 17:14:21 -08:00
Cameron Gutman 3145d34381 Print computer name when looking for mappings 2018-11-20 17:12:30 -08:00
Cameron Gutman c6837c95f1 Remove IPv6 UPnP code from MISS 2018-11-20 17:12:13 -08:00
Cameron Gutman 23ef57c20f Remove echo port from WOL list to avoid possible reflection from internal network hosts 2018-11-18 10:58:58 -08:00
Cameron Gutman 56a0b2f2ad Update README.md 2018-11-10 14:36:42 -08:00
Cameron Gutman 8875db4bd5 Update README.md 2018-11-10 14:14:25 -08:00
Cameron Gutman d2ab2c1180 Update README.md 2018-11-10 14:12:42 -08:00
Cameron Gutman b496b90888 Version 2.0 2018-11-10 00:27:45 -08:00
Cameron Gutman e7b5b07c4a Several minor bugfixes from final pre-release testing 2018-11-10 00:21:01 -08:00
Cameron Gutman 732b430da8 Implement best-effort forwarding for Wake-on-LAN 2018-11-09 17:06:31 -08:00
Cameron Gutman 5aea5aedab Ensure IPv6 PCP requests come from the correct address by explicitly binding 2018-11-08 19:46:43 -08:00
Cameron Gutman 5325a57e20 Improve failure messages for double NAT and NAT reflection failure 2018-11-08 19:31:52 -08:00
Cameron Gutman 92eeadadca Use PCP for mapping on CGNs 2018-11-08 19:19:18 -08:00
Cameron Gutman e7e37b8dfb Use a per-server PCP nonce to fix unmapping 2018-11-08 18:09:27 -08:00
Cameron Gutman 3906de1a3a Initial PCP implementation (not fully tested) 2018-11-07 22:06:40 -08:00
Cameron Gutman c47014887a Avoid making duplicate NAT-PMP requests to a UPnP gateway that was disconnected 2018-11-07 21:13:27 -08:00
Cameron Gutman 9dd169ba02 Fix memory leak if UPnP gateway lacked IPv6FC support 2018-11-07 18:00:54 -08:00
Cameron Gutman 4ee5b9d28a Fix handling of malformed SSDP responses 2018-11-07 17:55:11 -08:00
Cameron Gutman 176a1762d6 Allow deletion of upstream mappings if we can guarantee they are ours 2018-11-07 17:44:49 -08:00
Cameron Gutman 2ba42e6dd5 Handle large SSDP responses better 2018-11-07 17:35:46 -08:00
Cameron Gutman 852ee8df8d Fix socket leak in getUPnPDevicesByAddress() 2018-11-07 17:30:18 -08:00
Cameron Gutman 1b3fef5408 Fix RFC 6598 netmask for CGN 2018-11-07 17:28:33 -08:00
Cameron Gutman 1137825a4f Add the ability to punch through multiple NATs in some situations 2018-11-06 21:57:17 -08:00
Cameron Gutman c964830213 Move IPv6 FW check to the correct location 2018-11-06 20:39:59 -08:00
Cameron Gutman 1b8f15e259 Wait for the NAT-PMP response when deleting a conflicting entry 2018-11-06 20:24:45 -08:00
Cameron Gutman d379a4ee74 Don't hardcode the testing IP address 2018-11-06 20:13:47 -08:00
Cameron Gutman 1c9ecbfb78 Add traceroute code for experimental double NAT handling 2018-11-05 21:38:36 -08:00
Cameron Gutman 2899843900 Avoid using IPv6 FC if no control URL was present 2018-11-05 19:43:50 -08:00
Cameron Gutman 81ca65d7d4 Rewrite STUN code based on moonlight-common-c and with TCP+UDP support 2018-11-05 18:55:59 -08:00
Cameron Gutman e62ed6ccc5 Try deleting conflicting UPnP mappings 2018-11-05 17:51:37 -08:00
Cameron Gutman 774878ed17 Per RFC 6886, we should set publicport to 0 when deleting a NAT-PMP port mapping 2018-10-23 21:50:33 -07:00
Cameron Gutman aeb288b62b Version 1.3 2018-10-23 17:38:06 -07:00
Cameron Gutman d9320bed7d Print a version header on logs and console output 2018-10-23 17:36:48 -07:00
Cameron Gutman e8c39d1919 Print a message when we discover no UPnP devices at all 2018-10-23 17:13:09 -07:00
Cameron Gutman 1efebca1bd Fix displaying 2 dialogs when we detect a Double NAT 2018-10-23 17:12:47 -07:00
Cameron Gutman 222ed5a568 Catch bogus private port values returned for NAT-PMP conflict 2018-10-23 17:11:55 -07:00
Cameron Gutman 5da85a1fb2 Fix malformed UPnP lease duration 2018-10-23 17:11:05 -07:00
Cameron Gutman 83c4413926 Remove port forwarding entries when MISS is stopped 2018-10-22 09:33:18 -07:00
Cameron Gutman 15d60ed10a Offer to show the troubleshooting log for terminal warnings too 2018-10-21 23:45:22 -07:00
Cameron Gutman f1738fc11e Fix a misleading message if GameStream has never been enabled 2018-10-21 21:41:36 -07:00
Cameron Gutman 0867814ae8 Fix double NAT port test 2018-10-21 21:32:30 -07:00
Cameron Gutman 541a0bf9d9 Version 1.2 2018-10-21 21:23:02 -07:00
Cameron Gutman 632bba6da8 Minor cosmetic changes to wording and warnings 2018-10-21 21:17:25 -07:00
Cameron Gutman 0ec33223f4 Rename mist.log to mis-test.log 2018-10-21 21:04:29 -07:00
Cameron Gutman 45b624c203 Improve reliability with NAT reflection disabled, UPnP IGD reporting disconnected, double-NATs, and CGNs 2018-10-21 21:04:08 -07:00
Cameron Gutman 7bc806edb4 Increase polling rate to once per 2 minutes to ensure rules are updated quickly after a router reboot 2018-10-21 20:33:18 -07:00
Cameron Gutman afe60bfe30 Fix handling of IGD returning empty IP address and success status 2018-10-21 19:27:55 -07:00
Cameron Gutman ac4e0101f2 Fix brown-paper-bag comment mistake in subnet calculation 2018-10-21 19:25:11 -07:00
Cameron Gutman b619d7fed5 Remove unreferenced label 2018-10-20 20:36:22 -07:00
Cameron Gutman 522fa0426c Ensure that NAT-PMP is used if no UPnP IGD is found 2018-10-20 20:19:15 -07:00
Cameron Gutman c35241f7d6 Version 1.1 2018-10-20 20:01:59 -07:00
Cameron Gutman ae4346e587 Move mist.rc into Source Files section 2018-10-20 19:55:16 -07:00
Cameron Gutman 0e7bea68ae Fix GS state tracking 2018-10-20 19:54:49 -07:00
Cameron Gutman 8362f5495c Change MSI manufacturer string to "Moonlight Game Streaming Project" 2018-10-20 18:48:28 -07:00
Cameron Gutman 44625583b9 Unify the version information 2018-10-20 18:47:36 -07:00
Cameron Gutman 727e8c0339 Allow MIST testing after and during a GameStream session 2018-10-20 18:34:36 -07:00
Cameron Gutman fe4d895d88 Add console progress messages to MIST 2018-10-20 18:32:46 -07:00
Cameron Gutman 5d0b834efe Initialize COM before ShellExecute() 2018-10-20 18:32:10 -07:00
Cameron Gutman dad9b01a6f Fix uninitialized memory usage when UPNP_GetValidIGD() returns 3 2018-10-20 18:31:33 -07:00
Cameron Gutman 9a95d075e6 Convert cpp files to UTF-8 2018-10-20 18:29:33 -07:00
46 changed files with 1643 additions and 61 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "GS-IPv6-Forwarder"]
path = GS-IPv6-Forwarder
url = https://github.com/moonlight-stream/GS-IPv6-Forwarder.git
+1
Submodule GS-IPv6-Forwarder added at e0db902f7d
+13 -2
View File
@@ -1,2 +1,13 @@
# Internet-Streaming-Helper
Automatically configure and troubleshoot your router for using Moonlight over the Internet
# Moonlight Internet Hosting Tool
* Enable Moonlight streaming from your PC over the Internet with no configuration required
* Troubleshoot streaming issues with the included testing tool
# How to Use
1. Install the MSI package from the [GitHub Releases Page](https://github.com/moonlight-stream/Internet-Streaming-Helper/releases) on your host gaming PC.
2. If neccessary, run the Moonlight Internet Streaming Tester installed with this software.
# Technical Features
- Supports all major port forwarding protocols (UPnP, NAT-PMP, and PCP) for the best possible router compatibility
- Supports streaming on IPv4-only, IPv6-only, and dual-stack Internet connections
- Supports successful forwarding in double-NAT environments by configuring port mappings on all NATs found on the way to the Internet
- Supports forwarding on Carrier-Grade NATs (CGNs) by directly using PCP when the ISP doesn't implement UPnP-PCP interoperability
+3 -3
View File
@@ -1,9 +1,9 @@
/* $Id: miniupnpc.h,v 1.53 2018/05/07 11:05:16 nanard Exp $ */
/* $Id: miniupnpc.h,v 1.59 2021/09/28 21:39:17 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project: miniupnp
* http://miniupnp.free.fr/
* Author: Thomas Bernard
* Copyright (c) 2005-2018 Thomas Bernard
* Copyright (c) 2005-2021 Thomas Bernard
* This software is subjects to the conditions detailed
* in the LICENCE file provided within this distribution */
#ifndef MINIUPNPC_H_INCLUDED
@@ -20,7 +20,7 @@
#define UPNPDISCOVER_MEMORY_ERROR (-102)
/* versions : */
#define MINIUPNPC_VERSION "2.1"
#define MINIUPNPC_VERSION "2.2.3"
#define MINIUPNPC_API_VERSION 17
/* Source port:
+1 -1
View File
@@ -7,7 +7,7 @@
#ifndef MINIUPNPC_SOCKETDEF_H_INCLUDED
#define MINIUPNPC_SOCKETDEF_H_INCLUDED
#ifdef _MSC_VER
#ifdef _WIN32
#define ISINVALID(s) (INVALID_SOCKET==(s))
+4 -2
View File
@@ -1,13 +1,15 @@
/* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */
/* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org
* Author : Thomas Bernard
* Copyright (c) 2011 Thomas Bernard
* Copyright (c) 2021 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided within this distribution */
#ifndef MINIUPNPCTYPES_H_INCLUDED
#define MINIUPNPCTYPES_H_INCLUDED
#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
/* Use unsigned long long when available :
* strtoull is C99 */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define UNSIGNED_INTEGER unsigned long long
#define STRTOUI strtoull
#else
+65
View File
@@ -0,0 +1,65 @@
/* $Id: portlistingparse.h,v 1.10 2014/11/01 10:37:32 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2011-2015 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef PORTLISTINGPARSE_H_INCLUDED
#define PORTLISTINGPARSE_H_INCLUDED
#include "miniupnpc_declspec.h"
/* for the definition of UNSIGNED_INTEGER */
#include "miniupnpctypes.h"
#ifdef __cplusplus
extern "C" {
#endif
/* sample of PortMappingEntry :
<p:PortMappingEntry>
<p:NewRemoteHost>202.233.2.1</p:NewRemoteHost>
<p:NewExternalPort>2345</p:NewExternalPort>
<p:NewProtocol>TCP</p:NewProtocol>
<p:NewInternalPort>2345</p:NewInternalPort>
<p:NewInternalClient>192.168.1.137</p:NewInternalClient>
<p:NewEnabled>1</p:NewEnabled>
<p:NewDescription>dooom</p:NewDescription>
<p:NewLeaseTime>345</p:NewLeaseTime>
</p:PortMappingEntry>
*/
typedef enum { PortMappingEltNone,
PortMappingEntry, NewRemoteHost,
NewExternalPort, NewProtocol,
NewInternalPort, NewInternalClient,
NewEnabled, NewDescription,
NewLeaseTime } portMappingElt;
struct PortMapping {
struct PortMapping * l_next; /* list next element */
UNSIGNED_INTEGER leaseTime;
unsigned short externalPort;
unsigned short internalPort;
char remoteHost[64];
char internalClient[64];
char description[64];
char protocol[4];
unsigned char enabled;
};
struct PortMappingParserData {
struct PortMapping * l_head; /* list head */
portMappingElt curelt;
};
MINIUPNP_LIBSPEC void
ParsePortListing(const char * buffer, int bufsize,
struct PortMappingParserData * pdata);
MINIUPNP_LIBSPEC void
FreePortListing(struct PortMappingParserData * pdata);
#ifdef __cplusplus
}
#endif
#endif
+12 -4
View File
@@ -1,8 +1,8 @@
/* $Id: upnpdev.h,v 1.1 2015/08/28 12:14:19 nanard Exp $ */
/* $Id: upnpdev.h,v 1.4 2021/08/21 09:45:01 nanard Exp $ */
/* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
* Author : Thomas BERNARD
* copyright (c) 2005-2018 Thomas Bernard
* copyright (c) 2005-2021 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENSE file. */
#ifndef UPNPDEV_H_INCLUDED
@@ -20,7 +20,15 @@ struct UPNPDev {
char * st;
char * usn;
unsigned int scope_id;
char buffer[3];
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 flexible array member */
char buffer[];
#elif defined(__GNUC__)
char buffer[0];
#else
/* Fallback to a hack */
char buffer[1];
#endif
};
/* freeUPNPDevlist()
+63
View File
@@ -0,0 +1,63 @@
/* $Id: upnpreplyparse.h,v 1.19 2014/10/27 16:33:19 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef UPNPREPLYPARSE_H_INCLUDED
#define UPNPREPLYPARSE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
struct NameValue {
struct NameValue * l_next;
char name[64];
char value[128];
};
struct NameValueParserData {
struct NameValue * l_head;
char curelt[64];
char * portListing;
int portListingLength;
int topelt;
const char * cdata;
int cdatalen;
};
/* ParseNameValue() */
void
ParseNameValue(const char * buffer, int bufsize,
struct NameValueParserData * data);
/* ClearNameValueList() */
void
ClearNameValueList(struct NameValueParserData * pdata);
/* GetValueFromNameValueList() */
char *
GetValueFromNameValueList(struct NameValueParserData * pdata,
const char * Name);
#if 0
/* GetValueFromNameValueListIgnoreNS() */
char *
GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
const char * Name);
#endif
/* DisplayNameValueList() */
#ifdef DEBUG
void
DisplayNameValueList(char * buffer, int bufsize);
#endif
#ifdef __cplusplus
}
#endif
#endif
+7
View File
@@ -51,6 +51,13 @@ typedef unsigned short uint16_t;
#endif /* _WIN32 */
#include "natpmp_declspec.h"
/* Set to 9 by https://tools.ietf.org/html/rfc6886#section-3.1 which leads to a
* maximum timeout of 127.75 seconds, due to the initial 250 ms timeout doubling
* each time, so we allow a compile-time modification here.*/
#ifndef NATPMP_MAX_RETRIES
#define NATPMP_MAX_RETRIES (9)
#endif
typedef struct {
int s; /* socket */
in_addr_t gateway; /* default gateway (IPv4) */
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef DECLSPEC_H_INCLUDED
#define DECLSPEC_H_INCLUDED
#ifndef NATPMP_DECLSPEC_H_INCLUDED
#define NATPMP_DECLSPEC_H_INCLUDED
#if defined(_WIN32) && !defined(NATPMP_STATICLIB)
/* for windows dll */
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<?define VCREDIST_VER = "14.36.32532.0" ?>
<?define VCREDIST_X86_SIZE = "13837672" ?>
<?define VCREDIST_X86_SHA1 = "C9B5B7969E499A4FD9E580EF4187322778E1936A" ?>
<?define VCREDIST_X86_URL = "https://download.visualstudio.microsoft.com/download/pr/eaab1f82-787d-4fd7-8c73-f782341a0c63/5365A927487945ECB040E143EA770ADBB296074ECE4021B1D14213BDE538C490/VC_redist.x86.exe" ?>
<?define VCREDIST_X86_UPGRADE_CODE = "65E5BD06-6392-3027-8C26-853107D3CF1A" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="Moonlight Internet Hosting Tool" Manufacturer="Moonlight Game Streaming Project" Version="!(bind.packageVersion.mish)" UpgradeCode="a2ce5056-1114-44b9-b79b-952ef46d3d50">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="license.rtf"
ShowVersion="yes"
SuppressOptionsUI="yes"
/>
</BootstrapperApplicationRef>
<WixVariable Id="WixUILicenseRtf" Value="" />
<util:ProductSearch Id="VCREDIST_14_x86"
UpgradeCode="$(var.VCREDIST_X86_UPGRADE_CODE)"
Result="version"
Variable="VCREDIST_14_x86" />
<Chain>
<ExePackage Name="Microsoft Visual C++ 2015-2022 Redistributable - x86"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
InstallCommand="/install /quiet /norestart"
DownloadUrl="$(var.VCREDIST_X86_URL)"
DetectCondition="VCREDIST_14_x86 &gt;= v$(var.VCREDIST_VER)">
<RemotePayload Description="Microsoft Visual C++ 2015-2022 Redistributable - x86"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable - x86"
Size="$(var.VCREDIST_X86_SIZE)"
Version="$(var.VCREDIST_VER)"
Hash="$(var.VCREDIST_X86_SHA1)"/>
<!-- Newer version installed is fine -->
<ExitCode Value="1638" Behavior="success" />
</ExePackage>
<MsiPackage Id="mish" SourceFile="$(var.mish.TargetPath)" />
<MsiPackage SourceFile="$(var.GSv6FwdSetup.TargetPath)" />
</Chain>
</Bundle>
</Wix>
+124
View File
@@ -0,0 +1,124 @@
{\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fswiss Helvetica;}{\f1\fswiss\fcharset0 Helvetica;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Riched20 10.0.17713}\viewkind4\uc1
\pard\sa180\b\f0\fs28\lang9 GNU GENERAL PUBLIC LICENSE\par
\b0\fs24 Version 3, 29 June 2007\par
Copyright \f1\'a9 2007 Free Software Foundation, Inc. <{{\field{\*\fldinst{HYPERLINK "https://fsf.org/"}}{\fldrslt{https://fsf.org/\ul0\cf0}}}}\f1\fs24 >\par
\f0 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\par
\b\fs28 Preamble\par
\b0\fs24 The GNU General Public License is a free, copyleft license for software and other kinds of works.\par
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.\par
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.\par
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.\par
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\par
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.\par
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.\par
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.\par
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.\par
The precise terms and conditions for copying, distribution and modification follow.\par
\b\fs28 TERMS AND CONDITIONS\par
\fs24 0. Definitions.\par
\b0\ldblquote This License\rdblquote refers to version 3 of the GNU General Public License.\par
\ldblquote Copyright\rdblquote also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.\par
\ldblquote The Program\rdblquote refers to any copyrightable work licensed under this License. Each licensee is addressed as \ldblquote you\rdblquote . \ldblquote Licensees\rdblquote and \ldblquote recipients\rdblquote may be individuals or organizations.\par
To \ldblquote modify\rdblquote a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a \ldblquote modified version\rdblquote of the earlier work or a work \ldblquote based on\rdblquote the earlier work.\par
A \ldblquote covered work\rdblquote means either the unmodified Program or a work based on the Program.\par
To \ldblquote propagate\rdblquote a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.\par
To \ldblquote convey\rdblquote a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.\par
An interactive user interface displays \ldblquote Appropriate Legal Notices\rdblquote to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.\par
\b 1. Source Code.\par
\b0 The \ldblquote source code\rdblquote for a work means the preferred form of the work for making modifications to it. \ldblquote Object code\rdblquote means any non-source form of a work.\par
A \ldblquote Standard Interface\rdblquote means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.\par
The \ldblquote System Libraries\rdblquote of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A \ldblquote Major Component\rdblquote , in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.\par
The \ldblquote Corresponding Source\rdblquote for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.\par
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.\par
The Corresponding Source for a work in source code form is that same work.\par
\b 2. Basic Permissions.\par
\b0 All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.\par
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.\par
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.\par
\b 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\par
\b0 No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.\par
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.\par
\b 4. Conveying Verbatim Copies.\par
\b0 You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.\par
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.\par
\b 5. Conveying Modified Source Versions.\par
\b0 You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:\par
\pard\fi-360\li360\tx360\bullet\tab a) The work must carry prominent notices stating that you modified it, and giving a relevant date.\par
\bullet\tab b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to \ldblquote keep intact all notices\rdblquote .\par
\bullet\tab c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.\par
\pard\fi-360\li360\sa180\tx360\bullet\tab d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.\par
\pard\sa180 A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an \ldblquote aggregate\rdblquote if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.\par
\b 6. Conveying Non-Source Forms.\par
\b0 You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:\par
\pard\fi-360\li360\tx360\bullet\tab a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.\par
\bullet\tab b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.\par
\bullet\tab c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.\par
\bullet\tab d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.\par
\pard\fi-360\li360\sa180\tx360\bullet\tab e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.\par
\pard\sa180 A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.\par
A \ldblquote User Product\rdblquote is either (1) a \ldblquote consumer product\rdblquote , which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, \ldblquote normally used\rdblquote refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.\par
\ldblquote Installation Information\rdblquote for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.\par
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).\par
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.\par
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.\par
\b 7. Additional Terms.\par
\b0\ldblquote Additional permissions\rdblquote are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.\par
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.\par
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:\par
\pard\fi-360\li360\tx360\bullet\tab a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or\par
\bullet\tab b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or\par
\bullet\tab c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or\par
\bullet\tab d) Limiting the use for publicity purposes of names of licensors or authors of the material; or\par
\bullet\tab e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or\par
\pard\fi-360\li360\sa180\tx360\bullet\tab f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.\par
\pard\sa180 All other non-permissive additional terms are considered \ldblquote further restrictions\rdblquote within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.\par
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.\par
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.\par
\b 8. Termination.\par
\b0 You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).\par
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.\par
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.\par
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.\par
\b 9. Acceptance Not Required for Having Copies.\par
\b0 You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.\par
\b 10. Automatic Licensing of Downstream Recipients.\par
\b0 Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.\par
An \ldblquote entity transaction\rdblquote is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.\par
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.\par
\b 11. Patents.\par
\b0 A \ldblquote contributor\rdblquote is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's \ldblquote contributor version\rdblquote .\par
A contributor's \ldblquote essential patent claims\rdblquote are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, \ldblquote control\rdblquote includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.\par
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.\par
In the following three paragraphs, a \ldblquote patent license\rdblquote is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To \ldblquote grant\rdblquote such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.\par
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. \ldblquote Knowingly relying\rdblquote means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.\par
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.\par
A patent license is \ldblquote discriminatory\rdblquote if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.\par
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.\par
\b 12. No Surrender of Others' Freedom.\par
\b0 If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.\par
\b 13. Use with the GNU Affero General Public License.\par
\b0 Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.\par
\b 14. Revised Versions of this License.\par
\b0 The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\par
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License \ldblquote or any later version\rdblquote applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.\par
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.\par
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.\par
\b 15. Disclaimer of Warranty.\par
\b0 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \ldblquote AS IS\rdblquote WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par
\b 16. Limitation of Liability.\par
\b0 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\par
\b 17. Interpretation of Sections 15 and 16.\par
\b0 If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.\b\fs28\par
}
+65
View File
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>a2ce5056-1114-44b9-b79b-952ef46d3d50</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>InternetHostingToolSetup</OutputName>
<OutputType>Bundle</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Bundle.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixBalExtension">
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
<Name>WixBalExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GS-IPv6-Forwarder\GSv6FwdSetup\GSv6FwdSetup.wixproj">
<Name>GSv6FwdSetup</Name>
<Project>{f8171b99-f5f9-4abf-9fe5-6753539611af}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\mish\mish.wixproj">
<Name>mish</Name>
<Project>{f0dee5f3-4b62-47a3-b00b-61c614c924fd}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+20 -14
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2046
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miss", "miss\miss.vcxproj", "{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}"
EndProject
@@ -9,36 +9,42 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mist", "mist\mist.vcxproj",
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "mish", "mish\mish.wixproj", "{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "mish-setup", "mish-setup\mish-setup.wixproj", "{A2CE5056-1114-44B9-B79B-952EF46D3D50}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GSv6Fwd", "GS-IPv6-Forwarder\GSv6Fwd\GSv6Fwd.vcxproj", "{87DEAE49-7638-4CDB-88EB-054B1F3CB0D2}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "GSv6FwdSetup", "GS-IPv6-Forwarder\GSv6FwdSetup\GSv6FwdSetup.wixproj", "{F8171B99-F5F9-4ABF-9FE5-6753539611AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Debug|x64.ActiveCfg = Debug|x64
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Debug|x64.Build.0 = Debug|x64
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Debug|x86.ActiveCfg = Debug|Win32
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Debug|x86.Build.0 = Debug|Win32
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Release|x64.ActiveCfg = Release|x64
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Release|x64.Build.0 = Release|x64
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Release|x86.ActiveCfg = Release|Win32
{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}.Release|x86.Build.0 = Release|Win32
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Debug|x64.ActiveCfg = Debug|x64
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Debug|x64.Build.0 = Debug|x64
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Debug|x86.ActiveCfg = Debug|Win32
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Debug|x86.Build.0 = Debug|Win32
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Release|x64.ActiveCfg = Release|x64
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Release|x64.Build.0 = Release|x64
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Release|x86.ActiveCfg = Release|Win32
{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}.Release|x86.Build.0 = Release|Win32
{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}.Debug|x64.ActiveCfg = Debug|x86
{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}.Debug|x86.ActiveCfg = Debug|x86
{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}.Debug|x86.Build.0 = Debug|x86
{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}.Release|x64.ActiveCfg = Release|x86
{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}.Release|x86.ActiveCfg = Release|x86
{F0DEE5F3-4B62-47A3-B00B-61C614C924FD}.Release|x86.Build.0 = Release|x86
{A2CE5056-1114-44B9-B79B-952EF46D3D50}.Debug|x86.ActiveCfg = Debug|x86
{A2CE5056-1114-44B9-B79B-952EF46D3D50}.Debug|x86.Build.0 = Debug|x86
{A2CE5056-1114-44B9-B79B-952EF46D3D50}.Release|x86.ActiveCfg = Release|x86
{A2CE5056-1114-44B9-B79B-952EF46D3D50}.Release|x86.Build.0 = Release|x86
{87DEAE49-7638-4CDB-88EB-054B1F3CB0D2}.Debug|x86.ActiveCfg = Debug|Win32
{87DEAE49-7638-4CDB-88EB-054B1F3CB0D2}.Debug|x86.Build.0 = Debug|Win32
{87DEAE49-7638-4CDB-88EB-054B1F3CB0D2}.Release|x86.ActiveCfg = Release|Win32
{87DEAE49-7638-4CDB-88EB-054B1F3CB0D2}.Release|x86.Build.0 = Release|Win32
{F8171B99-F5F9-4ABF-9FE5-6753539611AF}.Debug|x86.ActiveCfg = Debug|x86
{F8171B99-F5F9-4ABF-9FE5-6753539611AF}.Debug|x86.Build.0 = Debug|x86
{F8171B99-F5F9-4ABF-9FE5-6753539611AF}.Release|x86.ActiveCfg = Release|x86
{F8171B99-F5F9-4ABF-9FE5-6753539611AF}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+91 -7
View File
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension">
<Product Id="*" Name="Moonlight Internet Streaming Helper" Language="1033" Version="1.0.0.0" Manufacturer="Cameron Gutman" UpgradeCode="cfc2fb53-88e2-4867-851d-9ed9fe7ab2a3">
xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="Moonlight Internet Hosting Tool" Language="1033" Version="!(bind.fileVersion.MistExe)"
Manufacturer="Moonlight Game Streaming Project" UpgradeCode="cfc2fb53-88e2-4867-851d-9ed9fe7ab2a3">
<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
@@ -12,13 +14,35 @@
</Feature>
</Product>
<!-- Enable the Windows Firewall service if it is disabled. Disabling the Windows Firewall service
will paradoxically block *all* incoming network traffic and prevent GameStream, MIST, MISS,
and other local servers from working at all. The proper way to disable Windows Firewall is via
the Windows Firewall control panel applet. -->
<Fragment>
<Property Id="MPSSVC_START">
<RegistrySearch Id="MpsSvcStart"
Root="HKLM"
Key="System\CurrentControlSet\Services\MpsSvc"
Name="Start"
Type="raw" />
</Property>
<SetProperty Id="EnableMpsSvc" Value='"[SystemFolder]sc.exe" config MpsSvc start= auto' Sequence="execute" Before="InstallInitialize"/>
<CustomAction Id="EnableMpsSvc" BinaryKey="WixCA" DllEntry="WixQuietExec"
Execute="deferred" Return="ignore" Impersonate="no"/>
<SetProperty Id="StartMpsSvc" Value='"[SystemFolder]net.exe" start MpsSvc' Sequence="execute" Before="InstallInitialize"/>
<CustomAction Id="StartMpsSvc" BinaryKey="WixCA" DllEntry="WixQuietExec"
Execute="deferred" Return="ignore" Impersonate="no"/>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Moonlight Internet Streaming Helper" />
<Directory Id="INSTALLFOLDER" Name="Moonlight Internet Hosting Tool" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Moonlight Internet Streaming Helper" />
<Directory Id="ApplicationProgramsFolder" Name="Moonlight Internet Hosting Tool" />
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Name="MISS" Id="MISSLogFolder" />
@@ -28,22 +52,31 @@
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="MiniupnpcDll">
<File Source="$(var.miss.TargetDir)miniupnpc.dll" KeyPath="yes"/>
</Component>
<Component Id="LibnatpmpDll">
<File Source="$(var.miss.TargetDir)libnatpmp.dll" KeyPath="yes"/>
</Component>
<Component Id="MISS">
<File Source="$(var.miss.TargetPath)" KeyPath="yes">
<fire:FirewallException Id="MISSFwException"
Scope="any"
Name="Moonlight Internet Streaming Service"/>
</File>
<CreateFolder Directory="MISSLogFolder" />
<CreateFolder Directory="MISSLogFolder">
<util:PermissionEx User="NT SERVICE\MISS" GenericAll="yes" />
</CreateFolder>
<ServiceInstall Type="ownProcess"
Name="MISS"
DisplayName="Moonlight Internet Streaming Service"
Description="Automatically manages router port forwarding rules required to use Moonlight over the Internet"
Start="auto"
Account="LocalSystem"
Account="NT AUTHORITY\LocalService"
ErrorControl="ignore"
Interactive="no">
<ServiceConfig DelayedAutoStart="no" OnInstall="yes" OnReinstall="yes" />
<ServiceConfig DelayedAutoStart="no" OnInstall="yes" OnReinstall="yes" ServiceSid="unrestricted"/>
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" ResetPeriodInDays="1" RestartServiceDelayInSeconds="10"/>
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="MISS" Wait="yes" />
</Component>
@@ -54,6 +87,48 @@
Name="Moonlight Internet Streaming Tester"/>
</File>
</Component>
<Component Id="GameStreamFirewallRules" Guid="{16CA2511-B533-46F8-8882-F8AEEFDFD7DF}" KeyPath="yes">
<fire:FirewallException Id="HttpsFwException"
Scope="any"
Port="47984"
Protocol="tcp"
Name="Moonlight - HTTPS"/>
<fire:FirewallException Id="HttpFwException"
Scope="any"
Port="47989"
Protocol="tcp"
Name="Moonlight - HTTP"/>
<fire:FirewallException Id="RtspFwException"
Scope="any"
Port="48010"
Protocol="tcp"
Name="Moonlight - RTSP"/>
<fire:FirewallException Id="VideoFwException"
Scope="any"
Port="47998"
Protocol="udp"
Name="Moonlight - Video"/>
<fire:FirewallException Id="ControlFwException"
Scope="any"
Port="47999"
Protocol="udp"
Name="Moonlight - Control"/>
<fire:FirewallException Id="AudioFwException"
Scope="any"
Port="48000"
Protocol="udp"
Name="Moonlight - Audio"/>
<fire:FirewallException Id="RtspuFwException"
Scope="any"
Port="48010"
Protocol="udp"
Name="Moonlight - RTSPU"/>
<fire:FirewallException Id="MdnsFwException"
Scope="any"
Port="5353"
Protocol="udp"
Name="Moonlight - mDNS"/>
</Component>
<Component Id="Shortcuts" Guid="*">
<Shortcut Id="StartMenuShortcut"
Name="Moonlight Internet Streaming Tester"
@@ -65,5 +140,14 @@
<RegistryValue Root="HKCU" Key="Software\Moonlight Internet Streaming Tester" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</ComponentGroup>
<InstallExecuteSequence>
<Custom Action="EnableMpsSvc" Before="StartMpsSvc">
<![CDATA[MPSSVC_START <> "#2"]]>
</Custom>
<Custom Action="StartMpsSvc" Before="StopServices">
<![CDATA[MPSSVC_START <> "#2"]]>
</Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
+8
View File
@@ -44,6 +44,14 @@
<HintPath>$(WixExtDir)\WixFirewallExtension.dll</HintPath>
<Name>WixFirewallExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
BIN
View File
Binary file not shown.
+7 -4
View File
@@ -1,16 +1,19 @@
#include <windows.h>
#include "version.h"
#include "../version.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
FILEVERSION VER_VERSION
PRODUCTVERSION VER_VERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "FileDescription", "Moonlight Internet Streaming Service"
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "FileVersion", VER_VERSION_STR
VALUE "ProductVersion", VER_VERSION_STR
END
END
+34 -8
View File
@@ -23,32 +23,32 @@
<ProjectGuid>{B71C4E7F-0D92-4E19-BBD2-D33F0EF879B1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>miss</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
@@ -93,13 +93,19 @@
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\libs\include;..\libs\include\miniupnpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\libs\x86\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<CETCompat>true</CETCompat>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Debug\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -111,11 +117,17 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<CETCompat>true</CETCompat>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Debug\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -130,7 +142,8 @@
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\libs\include;..\libs\include\miniupnpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ControlFlowGuard>Guard</ControlFlowGuard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -138,7 +151,11 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\libs\x86\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<CETCompat>true</CETCompat>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Release\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -152,22 +169,31 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<ControlFlowGuard>Guard</ControlFlowGuard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<CETCompat>true</CETCompat>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Release\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="miss.cpp" />
<ClCompile Include="pcp.cpp" />
<ClCompile Include="relay.cpp" />
<ClCompile Include="tracer.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="miss.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="version.h" />
<ClInclude Include="..\version.h" />
<ClInclude Include="relay.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+13 -1
View File
@@ -18,6 +18,15 @@
<ClCompile Include="miss.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tracer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pcp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="relay.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="miss.rc">
@@ -25,7 +34,10 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="version.h">
<ClInclude Include="..\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="relay.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
+311
View File
@@ -0,0 +1,311 @@
#define _CRT_RAND_S
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <Windows.h>
#include <WinSock2.h>
#include <WS2tcpip.h>
#pragma comment(lib, "Shlwapi.lib")
#include <shlwapi.h>
#include <assert.h>
#include <stdio.h>
#define RECV_TIMEOUT_SEC 3
#define PCP_VERSION 2
#define OPCODE_MAP_REQUEST 0x01
#define OPCODE_MAP_RESPONSE 0x81
#define CODE_PREFER_FAILURE 2
#pragma pack(push, 1)
typedef struct _PCP_REQUEST_HEADER {
unsigned char version;
unsigned char opcode;
unsigned short reserved;
unsigned int lifetime;
unsigned char localAddress[16];
} PCP_REQUEST_HEADER, *PPCP_REQUEST_HEADER;
typedef struct _PCP_RESPONSE_HEADER {
unsigned char version;
unsigned char opcode;
unsigned char reserved;
unsigned char result;
unsigned int lifetime;
unsigned int epoch;
unsigned char reserved2[12];
} PCP_RESPONSE_HEADER, *PPCP_RESPONSE_HEADER;
typedef struct _PCP_OPTION_HEADER {
unsigned char code;
unsigned char reserved;
unsigned short length;
} PCP_OPTION_HEADER, *PPCP_OPTION_HEADER;
typedef struct _PCP_MAP_REQUEST {
PCP_REQUEST_HEADER hdr;
unsigned char mappingNonce[12];
unsigned char protocol;
unsigned char reserved[3];
unsigned short internalPort;
unsigned short externalPort;
unsigned char externalAddress[16];
// We send PREFER_FAILURE too for MAP requests
PCP_OPTION_HEADER preferFailureOption;
} PCP_MAP_REQUEST, *PPCP_MAP_REQUEST;
typedef struct _PCP_MAP_RESPONSE {
PCP_RESPONSE_HEADER hdr;
unsigned char mappingNonce[12];
unsigned char protocol;
unsigned char reserved[3];
unsigned short internalPort;
unsigned short externalPort;
unsigned char externalAddress[16];
} PCP_MAP_RESPONSE, *PPCP_MAP_RESPONSE;
#pragma pack(pop)
static void populateMappingNonce(PPCP_MAP_REQUEST request, PSOCKADDR_STORAGE pcpAddr, int pcpAddrLen)
{
struct {
unsigned short port;
unsigned char localAddress[16];
SOCKADDR_STORAGE targetAddress;
} dataToHash;
assert(request->internalPort != 0);
dataToHash.port = request->internalPort;
memcpy(dataToHash.localAddress, request->hdr.localAddress, sizeof(dataToHash.localAddress));
memcpy(&dataToHash.targetAddress, pcpAddr, pcpAddrLen);
HashData((BYTE*)&dataToHash, 18 + pcpAddrLen, request->mappingNonce, sizeof(request->mappingNonce));
}
static void populateAddressFromSockAddr(PSOCKADDR_STORAGE sockAddr, unsigned char* address)
{
if (sockAddr->ss_family == AF_INET) {
PSOCKADDR_IN sin = (PSOCKADDR_IN)sockAddr;
memset(&address[0], 0, 10);
memset(&address[10], 0xFF, 2);
memcpy(&address[12], &sin->sin_addr, 4);
}
else if (sockAddr->ss_family == AF_INET6) {
PSOCKADDR_IN6 sin6 = (PSOCKADDR_IN6)sockAddr;
memcpy(address, &sin6->sin6_addr, 16);
}
else {
assert(false);
}
}
bool PCPMapPort(PSOCKADDR_STORAGE localAddr, int localAddrLen, PSOCKADDR_STORAGE pcpAddr, int pcpAddrLen, int proto, int port, bool enable, bool indefinite)
{
SOCKET sock;
PCP_MAP_REQUEST reqMsg;
int reqMsgLen;
int i;
int bytesRead;
union {
PCP_MAP_RESPONSE hdr;
char buf[1100];
} resp;
int lifetime;
if (!enable) {
lifetime = 0;
}
else if (indefinite) {
lifetime = 604800; // 1 week
}
else {
lifetime = 3600;
}
assert(localAddr->ss_family == pcpAddr->ss_family);
printf("Updating PCP port mapping for %s %d...", proto == IPPROTO_TCP ? "TCP" : "UDP", port);
sock = socket(localAddr->ss_family, SOCK_DGRAM, IPPROTO_UDP);
if (sock == INVALID_SOCKET) {
printf("socket() failed: %d\n", WSAGetLastError());
return false;
}
if (localAddr->ss_family == AF_INET6) {
// Make sure we're sourcing from the correct IPv6 address to ensure the port
// is opened correctly and that the PCP server doesn't refuse our mapping.
((PSOCKADDR_IN6)localAddr)->sin6_port = 0;
if (bind(sock, (struct sockaddr*)localAddr, localAddrLen) == SOCKET_ERROR) {
printf("bind() failed: %d\n", WSAGetLastError());
closesocket(sock);
return false;
}
}
((PSOCKADDR_IN)pcpAddr)->sin_port = htons(5351);
if (connect(sock, (struct sockaddr*)pcpAddr, pcpAddrLen) == SOCKET_ERROR) {
printf("connect() failed: %d\n", WSAGetLastError());
closesocket(sock);
return false;
}
// If we didn't get a local address, use the address of the interface we bound to.
// NB: We can't do this in all cases because we may be impersonating an upstream
// device if we're behind multiple NATs.
if (localAddr->ss_family == AF_INET && ((PSOCKADDR_IN)localAddr)->sin_addr.S_un.S_addr == 0) {
if (getsockname(sock, (struct sockaddr*)localAddr, &localAddrLen) == SOCKET_ERROR) {
printf("getsockname() failed: %d\n", WSAGetLastError());
closesocket(sock);
return false;
}
}
reqMsg = {};
reqMsg.hdr.version = PCP_VERSION;
reqMsg.hdr.opcode = OPCODE_MAP_REQUEST;
reqMsg.hdr.lifetime = htonl(lifetime);
populateAddressFromSockAddr(localAddr, reqMsg.hdr.localAddress);
reqMsg.protocol = proto;
reqMsg.internalPort = htons(port);
reqMsg.externalPort = htons(port);
SOCKADDR_STORAGE noneAddr = {};
noneAddr.ss_family = localAddr->ss_family;
populateAddressFromSockAddr(&noneAddr, reqMsg.externalAddress);
if (enable) {
// We don't want an alternate allocation if this fails
reqMsg.preferFailureOption.code = CODE_PREFER_FAILURE;
reqMsg.preferFailureOption.length = 0;
reqMsgLen = sizeof(reqMsg);
}
else {
// We don't append PREFER_FAILURE for an unmap request
reqMsgLen = sizeof(reqMsg) - sizeof(reqMsg.preferFailureOption);
}
// This must be done after the rest of the message is populated
populateMappingNonce(&reqMsg, pcpAddr, pcpAddrLen);
bytesRead = 0;
for (i = 0; i < RECV_TIMEOUT_SEC; i++) {
// Retransmit the request every second until the timeout elapses
if (send(sock, (char *)&reqMsg, reqMsgLen, 0) == SOCKET_ERROR) {
printf("send() failed: %d\n", WSAGetLastError());
closesocket(sock);
return false;
}
fd_set fds;
FD_ZERO(&fds);
FD_SET(sock, &fds);
struct timeval tv;
tv.tv_sec = 1;
tv.tv_usec = 0;
int selectRes = select(0, &fds, nullptr, nullptr, &tv);
if (selectRes == 0) {
// Timeout - continue looping
continue;
}
else if (selectRes == SOCKET_ERROR) {
printf("select() failed: %d\n", WSAGetLastError());
closesocket(sock);
return false;
}
// Error handling is below
bytesRead = recv(sock, resp.buf, sizeof(resp.buf), 0);
break;
}
if (bytesRead == 0) {
printf("NO RESPONSE\n");
goto fail;
}
else if (bytesRead == SOCKET_ERROR) {
printf("Failed to read PCP response: %d\n", WSAGetLastError());
goto fail;
}
else if (bytesRead < sizeof(resp.hdr)) {
printf("PCP message truncated: %d\n", bytesRead);
goto fail;
}
else if (resp.hdr.hdr.version != PCP_VERSION) {
printf("PCP version mismatch: %x\n", resp.hdr.hdr.version);
goto fail;
}
else if (resp.hdr.hdr.opcode != OPCODE_MAP_RESPONSE) {
printf("PCP message type mismatch: %x\n", resp.hdr.hdr.opcode);
goto fail;
}
else if (resp.hdr.hdr.result != 0) {
switch (resp.hdr.hdr.result) {
case 1: // UNSUPP_VERSION
printf("UNSUPPORTED\n");
break;
case 2: // NOT_AUTHORIZED
printf("UNAUTHORIZED\n");
break;
case 11: // CANNOT_PROVIDE_EXTERNAL
printf("CONFLICT\n");
break;
default:
printf("ERROR: %d\n", resp.hdr.hdr.result);
break;
}
goto fail;
}
else if (memcmp(reqMsg.mappingNonce, resp.hdr.mappingNonce, sizeof(reqMsg.mappingNonce))) {
printf("PCP mapping nonce mismatch\n");
goto fail;
}
else if (reqMsg.protocol != resp.hdr.protocol) {
printf("PCP protocol mismatch: %d wanted %d\n", resp.hdr.protocol, reqMsg.protocol);
goto fail;
}
else if (reqMsg.internalPort != resp.hdr.internalPort) {
printf("PCP internal port mismatch: %d wanted %d\n", htons(resp.hdr.internalPort), htons(reqMsg.internalPort));
goto fail;
}
else if (reqMsg.externalPort != resp.hdr.externalPort) {
printf("PCP returned different external port: %d wanted %d\n", htons(resp.hdr.externalPort), htons(reqMsg.externalPort));
if (enable) {
// Clear the port mapping by modifying and resending the old request (with the same nonce)
reqMsg.hdr.lifetime = 0;
reqMsg.externalPort = resp.hdr.externalPort;
reqMsgLen = sizeof(reqMsg) - sizeof(reqMsg.preferFailureOption);
if (send(sock, (char*)&reqMsg, reqMsgLen, 0) == SOCKET_ERROR) {
printf("Failed to unmap unexpected external port: %d\n", WSAGetLastError());
}
}
goto fail;
}
if (enable) {
printf("OK (%d seconds remaining)\n", ntohl(resp.hdr.hdr.lifetime));
}
else {
printf("DELETED\n");
}
closesocket(sock);
return true;
fail:
closesocket(sock);
return false;
}
+110
View File
@@ -0,0 +1,110 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <WinSock2.h>
#include <Ws2ipdef.h>
#include "relay.h"
typedef struct _UDP_TUPLE {
SOCKET socket;
unsigned short port;
} UDP_TUPLE, *PUDP_TUPLE;
DWORD
WINAPI
UdpRelayThreadProc(LPVOID Context)
{
PUDP_TUPLE tuple = (PUDP_TUPLE)Context;
USHORT nboPort = htons(tuple->port);
SOCKADDR_IN lastRemoteAddr;
// Ensure the relay threads aren't preempted by games or other CPU intensive activity
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
RtlZeroMemory(&lastRemoteAddr, sizeof(lastRemoteAddr));
for (;;) {
char buffer[4096];
SOCKADDR_IN sourceAddr;
int sourceAddrLen;
int recvLen;
sourceAddrLen = sizeof(sourceAddr);
recvLen = recvfrom(tuple->socket, buffer, sizeof(buffer), 0, (PSOCKADDR)&sourceAddr, &sourceAddrLen);
if (recvLen == SOCKET_ERROR) {
continue;
}
SOCKADDR_IN destinationAddr;
if (RtlEqualMemory(&sourceAddr.sin_addr, &in4addr_loopback, sizeof(sourceAddr.sin_addr)) && sourceAddr.sin_port == nboPort) {
// Traffic incoming from loopback interface - send it to the last remote address
destinationAddr = lastRemoteAddr;
}
else {
// Traffic incoming from the remote host - remember the source
lastRemoteAddr = sourceAddr;
// Send it to the normal port via the loopback adapter
destinationAddr = sourceAddr;
destinationAddr.sin_addr = in4addr_loopback;
destinationAddr.sin_port = nboPort;
}
sendto(tuple->socket, buffer, recvLen, 0, (PSOCKADDR)&destinationAddr, sizeof(destinationAddr));
}
closesocket(tuple->socket);
free(tuple);
return 0;
}
int StartUdpRelay(unsigned short Port)
{
SOCKET sock;
SOCKADDR_IN addr;
HANDLE thread;
PUDP_TUPLE tuple;
int error;
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock == INVALID_SOCKET) {
error = WSAGetLastError();
printf("socket() failed: %d\n", error);
return error;
}
// Bind to the alternate port
RtlZeroMemory(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(Port + RELAY_PORT_OFFSET);
if (bind(sock, (PSOCKADDR)&addr, sizeof(addr)) == SOCKET_ERROR) {
error = WSAGetLastError();
printf("bind() failed: %d\n", error);
closesocket(sock);
return error;
}
tuple = (PUDP_TUPLE)malloc(sizeof(*tuple));
if (tuple == NULL) {
return ERROR_OUTOFMEMORY;
}
tuple->socket = sock;
tuple->port = Port;
thread = CreateThread(NULL, 0, UdpRelayThreadProc, tuple, 0, NULL);
if (thread == NULL) {
error = GetLastError();
printf("CreateThread() failed: %d\n", error);
closesocket(sock);
return error;
}
CloseHandle(thread);
return 0;
}
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#define RELAY_PORT_OFFSET -10000
int StartUdpRelay(unsigned short Port);
+282
View File
@@ -0,0 +1,282 @@
#define WIN32_LEAN_AND_MEAN
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include <stdio.h>
#include <stdlib.h>
#define MINIUPNP_STATICLIB
#include <miniupnpc/miniupnpc.h>
static const char* k_SsdpSearchFormatString =
"M-SEARCH * HTTP/1.1\r\n"
"HOST: %s:1900\r\n"
"ST: ssdp:all\r\n"
"MAN: \"ssdp:discover\"\r\n"
"MX: 5\r\n"
"\r\n";
// Based on logic in https://github.com/miniupnp/miniupnp/blob/master/miniupnpc/minissdpc.c
static void
parseReply(const char* reply, int size,
const char** location, int *locationsize,
const char** st, int* stsize,
const char** usn, int* usnsize)
{
int lineStartIdx = 0;
int headerEndIdx = 0;
for (int i = 0; i < size; i++) {
switch (reply[i])
{
case ':':
// Stop parsing the header at the first colon, but ignore subsequent colons
if (headerEndIdx == 0) {
headerEndIdx = i;
}
break;
case '\r':
case '\n':
if (headerEndIdx != 0) {
// Skip the colon and spaces
do { headerEndIdx++; } while (reply[headerEndIdx] == ' ');
// Check if it's one of the values we care about
if (!_strnicmp(reply + lineStartIdx, "location:", 9)) {
*location = reply + headerEndIdx;
*locationsize = i - headerEndIdx;
}
else if (!_strnicmp(reply + lineStartIdx, "st:", 3)) {
*st = reply + headerEndIdx;
*stsize = i - headerEndIdx;
}
else if (!_strnicmp(reply + lineStartIdx, "usn:", 4)) {
*usn = reply + headerEndIdx;
*usnsize = i - headerEndIdx;
}
// Move on to the next header value
headerEndIdx = 0;
}
lineStartIdx = i + 1;
break;
default:
break;
}
}
}
struct UPNPDev* getUPnPDevicesByAddress(IN_ADDR address)
{
SOCKET s;
SOCKADDR_IN connAddr;
char searchBuffer[512];
int chars;
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == INVALID_SOCKET) {
printf("socket() failed: %d\n", WSAGetLastError());
return nullptr;
}
connAddr = {};
connAddr.sin_family = AF_INET;
connAddr.sin_port = htons(1900);
connAddr.sin_addr = address;
// Use connect() to ensure we don't get responses from other devices
if (connect(s, (struct sockaddr*)&connAddr, sizeof(connAddr)) == SOCKET_ERROR) {
printf("connect() failed: %d\n", WSAGetLastError());
closesocket(s);
return nullptr;
}
// We will be reading all responses at the end, so ensure we have ample buffer space
// to allow responses to accumulate without loss.
int recvBufferSize = 65535;
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char*)&recvBufferSize, sizeof(recvBufferSize)) == SOCKET_ERROR) {
printf("setsockopt() failed: %d\n", WSAGetLastError());
}
// Send the first search message with HOST set properly
chars = snprintf(searchBuffer, ARRAYSIZE(searchBuffer), k_SsdpSearchFormatString, inet_ntoa(address));
if (send(s, searchBuffer, chars, 0) == SOCKET_ERROR) {
printf("send() failed: %d\n", WSAGetLastError());
closesocket(s);
return nullptr;
}
// Send another search message with HOST set to 239.255.255.250 to avoid issues
// on routers that explicitly check for that HOST value
chars = snprintf(searchBuffer, ARRAYSIZE(searchBuffer), k_SsdpSearchFormatString, "239.255.255.250");
if (send(s, searchBuffer, chars, 0) == SOCKET_ERROR) {
printf("send() failed: %d\n", WSAGetLastError());
closesocket(s);
return nullptr;
}
Sleep(5000);
// Switch to non-blocking mode to read the responses
u_long mode = 1;
ioctlsocket(s, FIONBIO, &mode);
char responseBuffer[2048];
struct UPNPDev* deviceList = nullptr;
for (;;) {
int bytesRead = recv(s, responseBuffer, sizeof(responseBuffer) - 1, 0);
if (bytesRead == SOCKET_ERROR) {
if (WSAGetLastError() == WSAEMSGSIZE) {
// Skip packets larger than our buffer
printf("recv() message too large\n");
continue;
}
else if (WSAGetLastError() != WSAEWOULDBLOCK) {
printf("recv() failed: %d\n", WSAGetLastError());
}
break;
}
// Null-terminate the buffer
responseBuffer[bytesRead] = 0;
// Parse the first status line:
// HTTP/1.1 200 OK
char* protocol = strtok(responseBuffer, " ");
char* statusCodeStr = strtok(nullptr, " ");
char* statusMessage = strtok(nullptr, "\r");
// Check for a valid response header
if (protocol == nullptr) {
printf("Missing protocol in SSDP header\n");
continue;
}
else if (statusCodeStr == nullptr) {
printf("Missing status code in SSDP header\n");
continue;
}
// FIXME: Should we require statusMessage too?
else if (_stricmp(protocol, "HTTP/1.0") && _stricmp(protocol, "HTTP/1.1")) {
printf("Unexpected protocol: %s\n", protocol);
continue;
}
else if (atoi(statusCodeStr) != 200) {
printf("Unexpected status: %s %s\n", statusCodeStr, statusMessage);
continue;
}
// Parse the header options
char* remainder = strtok(nullptr, "");
const char* loc = nullptr;
const char* st = nullptr;
const char* usn = ""; // Initialize to empty since it's optional
int locSize = 0;
int stSize = 0;
int usnSize = 0;
parseReply(remainder, strlen(remainder),
&loc, &locSize, &st, &stSize, &usn, &usnSize);
if (!loc || locSize == 0 || !st || stSize == 0) {
printf("Required value missing: %d %d\n", locSize, stSize);
continue;
}
struct UPNPDev* newDev = (struct UPNPDev*)malloc(sizeof(*newDev) + usnSize + locSize + stSize + 3);
newDev->pNext = deviceList;
newDev->usn = &newDev->buffer[0];
memcpy(newDev->usn, usn, usnSize);
newDev->usn[usnSize] = 0;
newDev->descURL = newDev->usn + usnSize + 1;
memcpy(newDev->descURL, loc, locSize);
newDev->descURL[locSize] = 0;
newDev->st = newDev->descURL + locSize + 1;
memcpy(newDev->st, st, stSize);
newDev->st[stSize] = 0;
newDev->scope_id = 0; // IPv6 only
deviceList = newDev;
}
closesocket(s);
return deviceList;
}
// Start at TTL 2 to skip contacting our default gateway
#define TTL_START 2
bool getHopsIP4(IN_ADDR* hopAddress, int* hopAddressCount)
{
HANDLE icmpFile;
struct hostent* host;
const char* requestBuffer = "Test";
union {
ICMP_ECHO_REPLY replies[ANYSIZE_ARRAY];
char replyBuffer[128];
};
host = gethostbyname("moonlight-stream.org");
if (host == nullptr) {
printf("gethostbyname() failed: %d\n", WSAGetLastError());
return false;
}
icmpFile = IcmpCreateFile();
if (icmpFile == INVALID_HANDLE_VALUE) {
printf("IcmpCreateFile() failed: %d\n", GetLastError());
return false;
}
int ttl;
for (ttl = TTL_START; ttl - TTL_START < *hopAddressCount; ttl++)
{
IP_OPTION_INFORMATION ipOptions;
ipOptions.Ttl = ttl;
ipOptions.Tos = 0;
ipOptions.Flags = 0;
ipOptions.OptionsSize = 0;
DWORD replyCount = IcmpSendEcho(icmpFile,
*(IPAddr*)host->h_addr,
(LPVOID)requestBuffer, sizeof(requestBuffer),
&ipOptions,
replyBuffer, sizeof(replyBuffer),
3000);
if (replyCount == 0) {
printf("IcmpSendEcho() failed: %d\n", GetLastError());
break;
}
else if (replyCount != 1) {
printf("Got extra replies: %d\n", replyCount);
break;
}
if (replies[0].Status == IP_TTL_EXPIRED_TRANSIT) {
// Get the IP address that responded to us
printf("Hop %d: %s\n", ttl - TTL_START, inet_ntoa(*(IN_ADDR*)&replies[0].Address));
hopAddress[ttl - TTL_START] = *(IN_ADDR*)&replies[0].Address;
}
else {
// Bail on anything else
printf("Hop %d: %s (error %d)\n", ttl - TTL_START, inet_ntoa(*(IN_ADDR*)&replies[0].Address), replies[0].Status);
break;
}
}
IcmpCloseHandle(icmpFile);
*hopAddressCount = ttl - TTL_START;
return true;
}
-6
View File
@@ -1,6 +0,0 @@
#pragma once
#define VER_COMPANYNAME_STR "Moonlight Game Streaming Project"
#define VER_FILEVERSION 1,0,0,0
#define VER_FILEVERSION_STR "1.0.0.0\0"
#define VER_FILEDESCRIPTION_STR "Moonlight Internet Streaming Service"
BIN
View File
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
</assembly>
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#define _CRT_RAND_S
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <Windows.h>
#include <ws2tcpip.h>
#include <Iphlpapi.h>
#include <WinSock2.h>
#include "..\version.h"
#define CONSOLE_OUT stdout
#define LOG_OUT stderr
bool getExternalAddressPortIP4(unsigned short localPort, PSOCKADDR_IN wanAddr);
+24
View File
@@ -0,0 +1,24 @@
#include <windows.h>
#include "../version.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_VERSION
PRODUCTVERSION VER_VERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", "Moonlight Internet Streaming Tester"
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "FileVersion", VER_VERSION_STR
VALUE "ProductVersion", VER_VERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
+52 -7
View File
@@ -23,32 +23,32 @@
<ProjectGuid>{8F78D8D2-A837-489C-BAC5-81494C9CEF7A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>mist</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -93,13 +93,22 @@
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\libs\include;..\libs\include\miniupnpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\libs\x86\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<CETCompat>true</CETCompat>
</Link>
<Manifest>
<AdditionalManifestFiles>mist.exe.manifest</AdditionalManifestFiles>
</Manifest>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Debug\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -110,11 +119,20 @@
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<ControlFlowGuard>Guard</ControlFlowGuard>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<CETCompat>true</CETCompat>
</Link>
<Manifest>
<AdditionalManifestFiles>mist.exe.manifest</AdditionalManifestFiles>
</Manifest>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Debug\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -129,7 +147,8 @@
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\libs\include;..\libs\include\miniupnpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ControlFlowGuard>Guard</ControlFlowGuard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -137,7 +156,14 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\libs\x86\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<CETCompat>true</CETCompat>
</Link>
<Manifest>
<AdditionalManifestFiles>mist.exe.manifest</AdditionalManifestFiles>
</Manifest>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Release\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -150,16 +176,35 @@
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<ControlFlowGuard>Guard</ControlFlowGuard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<CETCompat>true</CETCompat>
</Link>
<Manifest>
<AdditionalManifestFiles>mist.exe.manifest</AdditionalManifestFiles>
</Manifest>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)libs\x86\Release\*" "$(TargetDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mist.cpp" />
<ClCompile Include="stun.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="mist.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\version.h" />
<ClInclude Include="mist.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="mist.exe.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+21
View File
@@ -18,5 +18,26 @@
<ClCompile Include="mist.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stun.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="mist.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="mist.rc">
<Filter>Source Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Manifest Include="mist.exe.manifest">
<Filter>Resource Files</Filter>
</Manifest>
</ItemGroup>
</Project>
+207
View File
@@ -0,0 +1,207 @@
#include "mist.h"
#include <stdio.h>
#define STUN_PORT 3478
#define STUN_RECV_TIMEOUT_SEC 5
#define STUN_MESSAGE_BINDING_REQUEST 0x0001
#define STUN_MESSAGE_BINDING_SUCCESS 0x0101
#define STUN_MESSAGE_COOKIE 0x2112a442
#define STUN_ATTRIBUTE_MAPPED_ADDRESS 0x0001
#define STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS 0x0020
#pragma pack(push, 1)
typedef struct _STUN_ATTRIBUTE_HEADER {
unsigned short type;
unsigned short length;
} STUN_ATTRIBUTE_HEADER, *PSTUN_ATTRIBUTE_HEADER;
typedef struct _STUN_MAPPED_IPV4_ADDRESS_ATTRIBUTE {
STUN_ATTRIBUTE_HEADER hdr;
unsigned char reserved;
unsigned char addressFamily;
unsigned short port;
unsigned int address;
} STUN_MAPPED_IPV4_ADDRESS_ATTRIBUTE, *PSTUN_MAPPED_IPV4_ADDRESS_ATTRIBUTE;
#define TXID_DWORDS 3
typedef struct _STUN_MESSAGE {
unsigned short messageType;
unsigned short messageLength;
unsigned int magicCookie;
int transactionId[TXID_DWORDS];
} STUN_MESSAGE, *PSTUN_MESSAGE;
#pragma pack(pop)
bool getExternalAddressPortIP4(unsigned short localPort, PSOCKADDR_IN wanAddr)
{
SOCKET sock;
STUN_MESSAGE reqMsg;
int i;
int bytesRead;
int err;
bool ret;
PSTUN_ATTRIBUTE_HEADER attribute;
PSTUN_MAPPED_IPV4_ADDRESS_ATTRIBUTE ipv4Attrib;
struct addrinfo* result;
struct addrinfo hints;
struct sockaddr_in bindAddr;
union {
STUN_MESSAGE hdr;
char buf[1024];
} resp;
sock = INVALID_SOCKET;
ret = false;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
err = getaddrinfo("stun.moonlight-stream.org", "3478", &hints, &result);
if (err != 0 || result == NULL) {
fprintf(LOG_OUT, "getaddrinfo() failed: %d\n", err);
return false;
}
sock = socket(hints.ai_family, hints.ai_socktype, hints.ai_protocol);
if (sock == INVALID_SOCKET) {
fprintf(LOG_OUT, "socket() failed: %d\n", WSAGetLastError());
goto Exit;
}
bindAddr = {};
bindAddr.sin_family = hints.ai_family;
bindAddr.sin_port = htons(localPort);
if (bind(sock, (struct sockaddr*)&bindAddr, sizeof(bindAddr)) == SOCKET_ERROR) {
fprintf(LOG_OUT, "bind() failed: %d\n", WSAGetLastError());
goto Exit;
}
reqMsg.messageType = htons(STUN_MESSAGE_BINDING_REQUEST);
reqMsg.messageLength = 0;
reqMsg.magicCookie = htonl(STUN_MESSAGE_COOKIE);
for (i = 0; i < TXID_DWORDS; i++) {
reqMsg.transactionId[i] = rand();
}
bytesRead = 0;
for (i = 0; i < STUN_RECV_TIMEOUT_SEC; i++) {
// Retransmit the request every second to all resolved IP addresses until the timeout elapses
for (struct addrinfo* current = result; current != NULL; current = current->ai_next) {
if (sendto(sock, (char*)&reqMsg, sizeof(reqMsg), 0, current->ai_addr, current->ai_addrlen) == SOCKET_ERROR) {
fprintf(LOG_OUT, "sendto() failed: %d\n", WSAGetLastError());
}
}
for (;;) {
fd_set fds;
FD_ZERO(&fds);
FD_SET(sock, &fds);
struct timeval tv;
tv.tv_sec = 1;
tv.tv_usec = 0;
int selectRes = select(0, &fds, nullptr, nullptr, &tv);
if (selectRes == 0) {
// Timeout - break to the enclosing loop
break;
}
else if (selectRes == SOCKET_ERROR) {
fprintf(LOG_OUT, "select() failed: %d\n", WSAGetLastError());
goto Exit;
}
// recvfrom() will return WSAECONNRESET if the socket has received an ICMP Port Unreachable
// message from one of the IP addresses we've attempted communication with. The socket is still
// operable (and may even contain queued messages to receive). We should ignore that error and
// continue reading, otherwise exit the loop.
bytesRead = recvfrom(sock, resp.buf, sizeof(resp.buf), 0, NULL, NULL);
if (bytesRead != SOCKET_ERROR || WSAGetLastError() != WSAECONNRESET) {
goto RecvDone;
}
}
}
RecvDone:
if (bytesRead == 0) {
fprintf(LOG_OUT, "No response from STUN server\n");
goto Exit;
}
else if (bytesRead == SOCKET_ERROR) {
fprintf(LOG_OUT, "Failed to read STUN binding response: %d\n", WSAGetLastError());
goto Exit;
}
else if (bytesRead < sizeof(resp.hdr)) {
fprintf(LOG_OUT, "STUN message truncated: %d\n", bytesRead);
goto Exit;
}
else if (htonl(resp.hdr.magicCookie) != STUN_MESSAGE_COOKIE) {
fprintf(LOG_OUT, "Bad STUN cookie value: %x\n", htonl(resp.hdr.magicCookie));
goto Exit;
}
else if (memcmp(reqMsg.transactionId, resp.hdr.transactionId, sizeof(reqMsg.transactionId))) {
fprintf(LOG_OUT, "STUN transaction ID mismatch\n");
goto Exit;
}
else if (htons(resp.hdr.messageType) != STUN_MESSAGE_BINDING_SUCCESS) {
fprintf(LOG_OUT, "STUN message type mismatch: %x\n", htons(resp.hdr.messageType));
goto Exit;
}
attribute = (PSTUN_ATTRIBUTE_HEADER)(&resp.hdr + 1);
bytesRead -= sizeof(resp.hdr);
while (bytesRead > sizeof(*attribute)) {
if (bytesRead < sizeof(*attribute) + htons(attribute->length)) {
fprintf(LOG_OUT, "STUN attribute out of bounds: %d\n", htons(attribute->length));
goto Exit;
}
// Mask off the comprehension bit
else if ((htons(attribute->type) & 0x7FFF) != STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS) {
// Continue searching if this wasn't our address
bytesRead -= sizeof(*attribute) + htons(attribute->length);
attribute = (PSTUN_ATTRIBUTE_HEADER)(((char*)attribute) + sizeof(*attribute) + htons(attribute->length));
continue;
}
ipv4Attrib = (PSTUN_MAPPED_IPV4_ADDRESS_ATTRIBUTE)attribute;
if (htons(ipv4Attrib->hdr.length) != 8) {
fprintf(LOG_OUT, "STUN address length mismatch: %d\n", htons(ipv4Attrib->hdr.length));
goto Exit;
}
else if (ipv4Attrib->addressFamily != 1) {
fprintf(LOG_OUT, "STUN address family mismatch: %x\n", ipv4Attrib->addressFamily);
goto Exit;
}
*wanAddr = {};
wanAddr->sin_family = AF_INET;
// The address and port are XORed with the cookie
wanAddr->sin_port = ipv4Attrib->port ^ (short)resp.hdr.magicCookie;
wanAddr->sin_addr.S_un.S_addr = ipv4Attrib->address ^ resp.hdr.magicCookie;
ret = true;
goto Exit;
}
fprintf(LOG_OUT, "No XOR mapped address found in STUN response!\n");
Exit:
if (sock != INVALID_SOCKET) {
closesocket(sock);
}
if (result != NULL) {
freeaddrinfo(result);
}
return ret;
}
+7
View File
@@ -0,0 +1,7 @@
#pragma once
#define VER_VERSION 5,6,1,0
#define VER_VERSION_STR "5.6.1.0"
#define VER_COMPANYNAME_STR "Moonlight Game Streaming Project"
#define VER_PRODUCTNAME_STR "Moonlight Internet Hosting Tool"