Complete sources for a monero webminer.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
5.6 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. // The MIT License (MIT)
  2. // Copyright (c) 2018-2019 - the webminerpool developer
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. // this software and associated documentation files (the "Software"), to deal in
  5. // the Software without restriction, including without limitation the rights to
  6. // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  7. // the Software, and to permit persons to whom the Software is furnished to do so,
  8. // subject to the following conditions:
  9. // The above copyright notice and this permission notice shall be included in all
  10. // copies or substantial portions of the Software.
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  13. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  14. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  15. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. using System;
  18. using System.Collections.Generic;
  19. using Fleck;
  20. namespace Server
  21. {
  22. public class EmptyConnectionInfo : IWebSocketConnectionInfo
  23. {
  24. #region IWebSocketConnectionInfo implementation
  25. public string SubProtocol
  26. {
  27. get
  28. {
  29. throw new NotImplementedException();
  30. }
  31. }
  32. public string Origin
  33. {
  34. get
  35. {
  36. throw new NotImplementedException();
  37. }
  38. }
  39. public string Host
  40. {
  41. get
  42. {
  43. throw new NotImplementedException();
  44. }
  45. }
  46. public string Path
  47. {
  48. get
  49. {
  50. throw new NotImplementedException();
  51. }
  52. }
  53. public string ClientIpAddress
  54. {
  55. get
  56. {
  57. return "127.0.0.1";
  58. }
  59. }
  60. public int ClientPort
  61. {
  62. get
  63. {
  64. throw new NotImplementedException();
  65. }
  66. }
  67. public IDictionary<string, string> Cookies
  68. {
  69. get
  70. {
  71. throw new NotImplementedException();
  72. }
  73. }
  74. public IDictionary<string, string> Headers
  75. {
  76. get
  77. {
  78. throw new NotImplementedException();
  79. }
  80. }
  81. public Guid Id
  82. {
  83. get
  84. {
  85. return Guid.Empty;
  86. }
  87. }
  88. public string NegotiatedSubProtocol
  89. {
  90. get
  91. {
  92. throw new NotImplementedException();
  93. }
  94. }
  95. #endregion
  96. }
  97. public class EmptyWebsocket : IWebSocketConnection
  98. {
  99. private static EmptyConnectionInfo eci =
  100. new EmptyConnectionInfo();
  101. #region IWebSocketConnection implementation
  102. public System.Threading.Tasks.Task Send(string message)
  103. {
  104. //throw new NotImplementedException ();
  105. return null;
  106. }
  107. public System.Threading.Tasks.Task Send(byte[] message)
  108. {
  109. throw new NotImplementedException();
  110. }
  111. public System.Threading.Tasks.Task SendPing(byte[] message)
  112. {
  113. throw new NotImplementedException();
  114. }
  115. public System.Threading.Tasks.Task SendPong(byte[] message)
  116. {
  117. throw new NotImplementedException();
  118. }
  119. public void Close()
  120. {
  121. }
  122. public Action OnOpen
  123. {
  124. get
  125. {
  126. throw new NotImplementedException();
  127. }
  128. set
  129. {
  130. throw new NotImplementedException();
  131. }
  132. }
  133. public Action OnClose
  134. {
  135. get
  136. {
  137. throw new NotImplementedException();
  138. }
  139. set
  140. {
  141. throw new NotImplementedException();
  142. }
  143. }
  144. public Action<string> OnMessage
  145. {
  146. get
  147. {
  148. throw new NotImplementedException();
  149. }
  150. set
  151. {
  152. throw new NotImplementedException();
  153. }
  154. }
  155. public Action<byte[]> OnBinary
  156. {
  157. get
  158. {
  159. throw new NotImplementedException();
  160. }
  161. set
  162. {
  163. throw new NotImplementedException();
  164. }
  165. }
  166. public Action<byte[]> OnPing
  167. {
  168. get
  169. {
  170. throw new NotImplementedException();
  171. }
  172. set
  173. {
  174. throw new NotImplementedException();
  175. }
  176. }
  177. public Action<byte[]> OnPong
  178. {
  179. get
  180. {
  181. throw new NotImplementedException();
  182. }
  183. set
  184. {
  185. throw new NotImplementedException();
  186. }
  187. }
  188. public Action<Exception> OnError
  189. {
  190. get
  191. {
  192. throw new NotImplementedException();
  193. }
  194. set
  195. {
  196. throw new NotImplementedException();
  197. }
  198. }
  199. public IWebSocketConnectionInfo ConnectionInfo
  200. {
  201. get
  202. {
  203. return EmptyWebsocket.eci;
  204. }
  205. }
  206. public bool IsAvailable
  207. {
  208. get
  209. {
  210. return false;
  211. }
  212. }
  213. #endregion
  214. }
  215. }