public IOServerNode(IO_SERVER mServer, string mProject) { Server = mServer; Project = mProject; mContextMenu = new ContextMenu(); mContextMenu.MenuItems.Add(new MenuItem("新建通道") { Tag = 1 }); mContextMenu.MenuItems.Add(new MenuItem("编辑采集站") { Tag = 2 }); mContextMenu.MenuItems.Add(new MenuItem("删除采集站工程") { Tag = 3 }); mContextMenu.MenuItems[0].Click += IOServerNode_Click; mContextMenu.MenuItems[1].Click += IOServerNode_Click; this.ContextMenu = mContextMenu; if (Server.SERVER_ID == null || Server.SERVER_ID == "") { Server.SERVER_IP = LocalIp.GetLocalIp(); Server.SERVER_ID = FormManager.ipToLong(Server.SERVER_IP); } this.Text = LocalIp.GetLocalIp(); ///当前加载工程的文件路径 this.Tag = Project; this.SelectedImageIndex = 0; this.StateImageIndex = 0; this.ImageIndex = 0; this.ExpandAll(); }
public void Start() { IsRunning = true; MainThread = new Thread(new ThreadStart(() => { try { AcceptReset = new ManualResetEvent(false); ListenSocket = new Socket(SocketType.Stream, ProtocolType.Tcp); ListenSocket.Bind(LocalIp); ListenSocket.Listen(100); OnLog(String.Format("[HttpServer] Listening on {0}", LocalIp.ToString())); } catch (Exception ex) { OnLog(string.Format("[HttpServer] Start failed: {0}", ex.ToString())); return; } while (IsRunning) { StartListening(); } })); MainThread.Start(); }
static void Main() { string mycurrentIp = LocalIp.GetLocalIPAddress(); Client client = new Client(mycurrentIp, 8888); client.ConnectToServer(); }
static void Main(string[] args) { int port = 8888; IPAddress iPAddress = IPAddress.Parse(LocalIp.GetLocalIPAddress()); Console.WriteLine("-- Server Started"); Console.WriteLine("---- Waiting for clients"); TcpServer server = new TcpServer(port, iPAddress); }
public override int GetHashCode() { unchecked { var hashCode = (FriendlyName != null ? FriendlyName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ RemoteHostId.GetHashCode(); hashCode = (hashCode * 397) ^ (LocalIp != null ? LocalIp.GetHashCode() : 0); return(hashCode); } }
public void InitNode() { if (Server != null) { this.Text = LocalIp.GetLocalIp(); this.Name = Server.SERVER_ID; this.ImageIndex = 0; this.SelectedImageIndex = 0; } }
/// <summary> /// Makes a UDP connection and extracts the local IP address /// </summary> /// <returns>A local IPv4 address as a string</returns> public string GetLocalIp() { IPAddress LocalIp; using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)) { socket.Connect("8.8.8.8", 65530); IPEndPoint endPoint = (IPEndPoint)socket.LocalEndPoint; LocalIp = endPoint.Address; } return(LocalIp.ToString()); }
public Task <IRequestEntry> BeginRequestAsync(string app, string traceId, string traceDepth, string clientIp = "") { var als = RequestEntry.ALS.Value; als.App = app; als.TraceId = traceId; als.TraceDepth = traceDepth; als.ClientIp = clientIp; als.BeginTime = DateTime.Now; als.LocalIp = LocalIp.GetLocalIPV4(); return(Task.FromResult(als)); }
public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(LocalIp.ToString()); if (RemoteIp != null) { sb.AppendLine(RemoteIp.ToString()); } if (!String.IsNullOrEmpty(ProcessName)) { sb.AppendLine($"{ProcessName} ({ProcessId})"); if (ProcessFilename != null) { sb.AppendLine(ProcessFilename); } } else { sb.AppendLine("Process not available"); } sb.AppendLine(); return(sb.ToString()); }
/// <summary> /// Logs into the Steam network as a game server /// </summary> /// <param name="appId"></param> /// <param name="token"></param> /// <returns></returns> public async Task LoginGameServerAsync(int appId, string token) { if (string.IsNullOrWhiteSpace(token)) { throw new ArgumentException("The token cannot be null or whitespace", nameof(token)); } CMsgClientLogon logon = new CMsgClientLogon() { protocol_version = _currentProtocolVer, obfustucated_private_ip = (uint)(GetConfig <SteamNetworkConfig>().LoginId < 0 ? LocalIp.ToUInt32() ^ _obfuscationMask : GetConfig <SteamNetworkConfig>().LoginId), client_os_type = (uint)HardwareUtils.GetCurrentOsType(), game_server_app_id = appId, machine_id = await HardwareUtils.GetMachineId().ConfigureAwait(false), game_server_token = token }; NetworkMessage message = NetworkMessage .CreateProtobufMessage(MessageType.ClientLogonGameServer, logon) .WithClientInfo(new SteamId(0, GetConfig <SteamNetworkConfig>().DefaultUniverse, AccountType.GameServer, 0), 0); await SendAsync(message.Serialize()).ConfigureAwait(false); }
private void ClientForm_Load(object sender, EventArgs e) { systimer.Start(); labelIP.Text = LocalIp.GetLocalIp(); computerInfoControl.Monitour(); }
public influxdConfig() { ConfigItem Reporting_Disabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "reporting-disabled", Value = "false", DefaultValue = "false", Description = "该选项用于上报influxdb的使用信息给InfluxData公司,默认值为false" }; ConfigItem Bind_Address = new ConfigItem() { ItemType = ConfigItemType.字符串, Key = "bind-address", Value = "" + LocalIp.GetLocalIp() + ":8088", DefaultValue = "" + LocalIp.GetLocalIp() + ":8088", Description = "备份恢复时使用,默认值为8088" }; HeadItem.Items.Add(Reporting_Disabled); HeadItem.Items.Add(Bind_Address); HeadItem.Name = "HEAD"; HeadItem.Description = @"如果未指定配置选项。注释行是配置字段和使用的默认值。取消对行的注释并更改值将更改进程重新启动时在运行时使用的值。"; //[meta] 控制存储有关InfluxDB群集的元数据的Raft共识组的参数。 ConfigItem Meta_Dir = new ConfigItem() { ItemType = ConfigItemType.路径, Key = "dir", Value = Application.StartupPath + "/influxdb/meta", DefaultValue = Application.StartupPath + "/influxdb/meta", Description = "Meta数据存放目录,默认值:/var/lib/influxdb/meta" }; ConfigItem Meta_Retention_Autocreate = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "retention-autocreate", DefaultValue = "true", Value = "true", Description = "用于控制默认存储策略,数据库创建时,会自动生成autogen的存储策略,默认值:true" }; ConfigItem Meta_Logging_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "logging-enabled", Value = "true", DefaultValue = "true", Description = "是否开启meta日志,默认值:true" }; MetaItem.Name = "meta"; MetaItem.Description = "控制存储有关InfluxDB群集的元数据的Raft共识组的参数"; MetaItem.Items.Add(Meta_Dir); MetaItem.Items.Add(Meta_Retention_Autocreate); MetaItem.Items.Add(Meta_Logging_Enabled); //[data] 控制InfluxDB的实际分片数据的生存位置以及它从WAL中刷新的方式。 “dir”可能需要更改为适合您系统的位置,但WAL设置是高级配置。 默认值应适用于大多数系统。 //最终数据(TSM文件)存储目录,默认值:/var/lib/influxdb/data ConfigItem Data_Dir = new ConfigItem() { ItemType = ConfigItemType.路径, Key = "dir", Value = Application.StartupPath + "/influxdb/data", DefaultValue = Application.StartupPath + "/influxdb/data", Description = "最终数据(TSM文件)存储目录,默认值:/var/lib/influxdb/data" }; ConfigItem Data_Wal_Dir = new ConfigItem() { ItemType = ConfigItemType.路径, Key = "wal-dir", Value = Application.StartupPath + "/influxdb/wal", DefaultValue = Application.StartupPath + "/influxdb/wal", Description = "预写日志存储目录,默认值:/var/lib/influxdb/wal" }; ConfigItem Data_Wal_Fsync_Delay = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "wal-fsync-delay", Value = "0s", DefaultValue = "0s", Description = "在同步写入之前等待的总时间,默认0s" }; ConfigItem Data_Query_Log_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "query-log-enabled", Value = "true", DefaultValue = "true", Description = "是否开启tsm引擎查询日志,默认值: true" }; ConfigItem Data_Cache_Max_Memory_size = new ConfigItem() { ItemType = ConfigItemType.存储单位, Key = "cache-max-memory-size", Value = "1g", DefaultValue = "1g", Description = "用于限定shard最大值,大于该值时会拒绝写入,默认值,默认值:1G" }; ConfigItem Data_Cache_Snapshot_Memory_size = new ConfigItem() { ItemType = ConfigItemType.存储单位, Key = "cache-snapshot-memory-size", Value = "25m", DefaultValue = "25m", Description = "用于设置快照大小,大于该值时数据会刷新到tsm文件,默认值:25m" }; ConfigItem Data_Cache_Snapshot_Write_Cold_Duration = new ConfigItem() { ItemType = ConfigItemType.存储单位, Key = "cache-snapshot-write-cold-duration", Value = "10m", DefaultValue = "10m", Description = "tsm1引擎 snapshot写盘延迟,默认值:10m" }; ConfigItem Data_Compact_Full_Write_Cold_Duration = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "compact-full-write-cold-duration", Value = "4h", DefaultValue = "4h", Description = "tsm文件在压缩前可以存储的最大时间,默认值:4h" }; ConfigItem Data_Max_Concurrent_Compactions = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-concurrent-compactions", Value = "0", DefaultValue = "0", Description = "压缩并发的最大数量,默认设置为0,默认值:0" }; ConfigItem Data_Max_Series_Per_Database = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-series-per-database", Value = "1000000", DefaultValue = "1000000", Description = "限制数据库的级数,该值为0时取消限制,默认值:1000000" }; ConfigItem Data_Max_Values_Per_Tag = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-values-per-tag", Value = "100000", DefaultValue = "100000", Description = "一个tag最大的value数,0取消限制,默认值:100000" }; ConfigItem Data_Trace_Logging_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "trace-logging-enabled", Value = "false", DefaultValue = "false", Description = "是否开启trace日志,默认值: false" }; ConfigItem Data_Max_Index_Log_File_Size = new ConfigItem() { ItemType = ConfigItemType.存储单位, Key = "max-index-log-file-size", Value = "1m", DefaultValue = "1m", Description = "限制索引日志文件大小,默认值: 1m" }; ConfigItem Data_Tsm_Use_Madv_Willneed = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "tsm-use-madv-willneed", Value = "false", DefaultValue = "false", Description = "如果为true,mmap的建议值MADV_WILLNEED会被提供给内核,默认值: false" }; DataItem.Description = "控制InfluxDB的实际分片数据的生存位置以及它从WAL中刷新的方式。 “dir”可能需要更改为适合您系统的位置,但WAL设置是高级配置。 默认值应适用于大多数系统"; DataItem.Name = "data"; DataItem.Items.Add(Data_Dir); DataItem.Items.Add(Data_Wal_Dir); DataItem.Items.Add(Data_Wal_Fsync_Delay); DataItem.Items.Add(Data_Query_Log_Enabled); DataItem.Items.Add(Data_Cache_Max_Memory_size); DataItem.Items.Add(Data_Cache_Snapshot_Memory_size); DataItem.Items.Add(Data_Cache_Snapshot_Write_Cold_Duration); DataItem.Items.Add(Data_Compact_Full_Write_Cold_Duration); DataItem.Items.Add(Data_Max_Concurrent_Compactions); DataItem.Items.Add(Data_Max_Series_Per_Database); DataItem.Items.Add(Data_Max_Values_Per_Tag); DataItem.Items.Add(Data_Trace_Logging_Enabled); DataItem.Items.Add(Data_Max_Index_Log_File_Size); DataItem.Items.Add(Data_Tsm_Use_Madv_Willneed); //[coordinator] 控制群集服务配置 ConfigItem Coordinator_Write_Timeout = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "write-timeout", Value = "10s", DefaultValue = "10s", Description = "写操作超时时间,默认值: 10s" }; ConfigItem Coordinator_Query_Timeout = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "query-timeout", Value = "0s", DefaultValue = "0s", Description = "查询操作超时时间,0无限制,默认值:0s" }; ConfigItem Coordinator_Log_Queries_After = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "log-queries-after", Value = "0s", DefaultValue = "0s", Description = "慢查询超时时间,0无限制,默认值:0s" }; ConfigItem Coordinator_Max_Select_Point = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-select-point", Value = "0", DefaultValue = "0", Description = "SELECT语句可以处理的最大点数(points),0无限制,默认值:0" }; ConfigItem Coordinator_Max_Select_Series = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-select-series", Value = "0", DefaultValue = "0", Description = "SELECT语句可以处理的最大级数(series),0无限制,默认值:0" }; ConfigItem Coordinator_Max_Select_Buckets = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-select-buckets", Value = "0", DefaultValue = "0", Description = "SELECT语句可以处理的最大'GROUP BY time()'的时间周期,0无限制,默认值:0" }; CoordinatorItem.Description = "控制群集服务配置"; CoordinatorItem.Name = "coordinator"; CoordinatorItem.Items.Add(Coordinator_Write_Timeout); CoordinatorItem.Items.Add(Coordinator_Query_Timeout); CoordinatorItem.Items.Add(Coordinator_Log_Queries_After); CoordinatorItem.Items.Add(Coordinator_Max_Select_Point); CoordinatorItem.Items.Add(Coordinator_Max_Select_Series); CoordinatorItem.Items.Add(Coordinator_Max_Select_Buckets); //[retention] 旧数据的保留策略 ConfigItem Retention_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "enabled", Value = "true", DefaultValue = "true", Description = " 是否启用该模块,默认值 : true" }; ConfigItem Retention_Check_Interval = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "check-interval", Value = "30m", DefaultValue = "30m", Description = " 检查时间间隔,默认值 :30m" }; RetentionItem.Description = "旧数据的保留策略"; RetentionItem.Name = "retention"; RetentionItem.Items.Add(Retention_Enabled); RetentionItem.Items.Add(Retention_Check_Interval); //[shard-precreation] 分区预创建。 ConfigItem Shard_Retention_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "enabled", Value = "true", DefaultValue = "true", Description = " 是否启用该模块,默认值 : true" }; ConfigItem Shard_Check_Interval = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "check-interval", Value = "10m", DefaultValue = "10m", Description = " 检查时间间隔,默认值 :10m" }; ConfigItem Shard_Advance_Period = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "advance-period", Value = "30m", DefaultValue = "30m", Description = " 预创建分区的最大提前时间,默认值 :30m" }; Shard_PrecreationItem.Description = "分区预创建"; Shard_PrecreationItem.Name = "shard-precreation"; Shard_PrecreationItem.Items.Add(Shard_Retention_Enabled); Shard_PrecreationItem.Items.Add(Shard_Check_Interval); Shard_PrecreationItem.Items.Add(Shard_Advance_Period); //[admin]:influxdb提供的简单web管理页面。 ConfigItem Admin_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "enabled", Value = "false", DefaultValue = "false", Description = "是否启用该模块,默认值 :true" }; ConfigItem Admin_Bind_Address = new ConfigItem() { ItemType = ConfigItemType.字符串, Key = "bind-address", Value = LocalIp.GetLocalIp() + ":8083", DefaultValue = LocalIp.GetLocalIp() + ":8083", Description = "绑定地址,默认值 :8083" }; ConfigItem Admin_Https_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "https-enabled", Value = "false", DefaultValue = "false", Description = "是否开启https ,默认值 :false" }; ConfigItem Admin_Https_Certificate = new ConfigItem() { ItemType = ConfigItemType.路径, Key = "https-certificate", Value = Application.StartupPath + "/etc/ssl/influxdb.pem", DefaultValue = Application.StartupPath + "/etc/ssl/influxdb.pem", Description = "https证书路径,默认值:/ etc / ssl / influxdb.pem" }; AdminItem.Description = "influxdb提供的简单web管理页面"; AdminItem.Name = "admin"; AdminItem.Items.Add(Admin_Enabled); AdminItem.Items.Add(Admin_Bind_Address); AdminItem.Items.Add(Admin_Https_Enabled); AdminItem.Items.Add(Admin_Https_Certificate); //[monitor] 这一部分控制InfluxDB自有的监控系统。 默认情况下,InfluxDB把这些数据写入_internal 数据库,如果这个库不存在则自动创建。 _internal 库默认的retention策略是7天,如果你想使用一个自己的retention策略,需要自己创建。 ConfigItem Monitor_Store_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "store-enabled", Value = "true", DefaultValue = "true", Description = "是否启用该模块,默认值 :true" }; ConfigItem Monitor_Store_Database = new ConfigItem() { ItemType = ConfigItemType.字符串, Key = "store-database", Value = "_internal", DefaultValue = "_internal", Description = "默认数据库:_internal" }; ConfigItem Monitor_Store_Interval = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "store-interval", Value = "10s", DefaultValue = "10s", Description = "统计间隔,默认值:“10s”" }; MonitorItem.Description = "这一部分控制InfluxDB自有的监控系统。 默认情况下,InfluxDB把这些数据写入_internal 数据库,如果这个库不存在则自动创建。 _internal 库默认的retention策略是7天,如果你想使用一个自己的retention策略,需要自己创建"; MonitorItem.Name = "monitor"; MonitorItem.Items.Add(Monitor_Store_Enabled); MonitorItem.Items.Add(Monitor_Store_Database); MonitorItem.Items.Add(Monitor_Store_Interval); //[http]:influxdb的http接口配置。 ConfigItem Http_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "enabled", Value = "true", DefaultValue = "true", Description = "是否启用该模块,默认值 :true" }; ConfigItem Http_Flux_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "flux-enabled", Value = "false", DefaultValue = "false", Description = "是否启用流查询端点,默认值 :false" }; Http_Bind_Address = new ConfigItem() { ItemType = ConfigItemType.字符串, Key = "bind-address", Value = LocalIp.GetLocalIp() + ":8086", DefaultValue = LocalIp.GetLocalIp() + ":8086", Description = "绑定地址,默认值:8086" }; ConfigItem Http_Auth_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "auth-enabled", Value = "false", DefaultValue = "false", Description = "是否开启认证,默认值:false" }; ConfigItem Http_Realm = new ConfigItem() { Key = "realm", Value = "InfluxDB", DefaultValue = "InfluxDB", Description = "发出基本身份验证质询时发送回的默认域,默认值:InfluxDB" }; ConfigItem Http_Log_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "log-enabled", Value = "true", DefaultValue = "true", Description = "是否开启http请求日志,默认值:true" }; ConfigItem Http_Suppress_Write_Log = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "suppress-write-log", DefaultValue = "false", Value = "false", Description = "在启用日志时是否应禁止HTTP写入请求日志,默认值:false" }; ConfigItem Http_Access_Log_Path = new ConfigItem() { Key = "access-log-path", Value = "", DefaultValue = "", Description = "启用HTTP请求日志记录时,此选项指定应写入日志条目的路径。如果未指定,则默认为写入stderr,它将HTTP日志与内部InfluxDB日志记录混合。如果涌入无法访问指定路径,它将记录错误并回退到将请求日志写入stderr。" }; ConfigItem Http_Writer_Tracing = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "write-tracing", Value = "false", DefaultValue = "false", Description = "是否开启写操作日志,如果置成true,每一次写操作都会打日志,默认值:false" }; ConfigItem Http_Pprof_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "pprof-enabled", Value = "true", DefaultValue = "true", Description = "是否开启pprof,此端点用于故障排除和监视,默认值:true" }; ConfigItem Http_Debug_Pprof_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "debug-pprof-enabled", Value = "false", DefaultValue = "false", Description = "在启动时立即启用绑定到localhost:6060的pprof端点。这只需要调试启动问题。默认值:false" }; ConfigItem Http_Https_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "https-enabled", Value = "false", DefaultValue = "false", Description = "是否开启https,默认值:false" }; ConfigItem Http_Https_Certificate = new ConfigItem() { ItemType = ConfigItemType.路径, Key = "https-certificate", Value = Application.StartupPath + "/etc/ssl/influxdb.pem", DefaultValue = Application.StartupPath + "/etc/ssl/influxdb.pem", Description = "设置https证书路径,默认值:/ etc / ssl / influxdb.pem" }; ConfigItem Http_Max_Row_Limit = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-row-limit", Value = "10000", DefaultValue = "10000", Description = "配置查询返回最大行数,默认值:10000" }; ConfigItem Http_Max_Connection_Limit = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-connection-limit", Value = "0", DefaultValue = "0", Description = "配置最大连接数,超出此限制的新连接将被删除,0无限制,默认值:0" }; ConfigItem Http_Unix_Socket_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "unix-socket-enabled", Value = "false", DefaultValue = "false", Description = "通过unix域套接字启用http服务,默认值:false" }; ConfigItem Http_Bind_Socket = new ConfigItem() { ItemType = ConfigItemType.路径, Key = "bind-socket", Value = Application.StartupPath + "/var/run/influxdb.sock", DefaultValue = Application.StartupPath + "/var/run/influxdb.sock", Description = "unix-socket路径,默认值: / var / run / influxdb.sock" }; ConfigItem Http_Max_Body_Size = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-body-size", Value = "25000000", DefaultValue = "25000000", Description = "客户端请求正文的最大大小(以字节为单位), 将此值设置为0将禁用该限制。默认值:25000000。" }; ConfigItem Http_Concurrent_Write_Limit = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-concurrent-write-limit", Value = "0", DefaultValue = "0", Description = "并发处理的最大写入次数,将此设置为0将禁用该限制。默认值:0。" }; ConfigItem Http_Enqueued_Write_Limit = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "max-enqueued-write-limit", Value = "0", DefaultValue = "0", Description = "写入等待队列中写入的最长持续时间。将此设置为0或将max-concurrent-write-limit设置为0将禁用该限制。默认值:0" }; HttpItem.Description = "influxdb的http接口配置"; HttpItem.Name = "http"; HttpItem.Items.Add(Http_Enabled); HttpItem.Items.Add(Http_Flux_Enabled); HttpItem.Items.Add(Http_Bind_Address); HttpItem.Items.Add(Http_Auth_Enabled); HttpItem.Items.Add(Http_Realm); HttpItem.Items.Add(Http_Log_Enabled); HttpItem.Items.Add(Http_Suppress_Write_Log); HttpItem.Items.Add(Http_Access_Log_Path); HttpItem.Items.Add(Http_Writer_Tracing); HttpItem.Items.Add(Http_Pprof_Enabled); HttpItem.Items.Add(Http_Debug_Pprof_Enabled); HttpItem.Items.Add(Http_Https_Enabled); HttpItem.Items.Add(Http_Https_Certificate); HttpItem.Items.Add(Http_Max_Row_Limit); HttpItem.Items.Add(Http_Max_Connection_Limit); HttpItem.Items.Add(Http_Unix_Socket_Enabled); HttpItem.Items.Add(Http_Bind_Socket); HttpItem.Items.Add(Http_Max_Body_Size); HttpItem.Items.Add(Http_Concurrent_Write_Limit); HttpItem.Items.Add(Http_Enqueued_Write_Limit); //[logging]:控制记录器如何将日志发送到输出。 ConfigItem Logging_Format = new ConfigItem() { ItemType = ConfigItemType.多项列表, SelectItems = new List <string>() { "auto", "logfmt", "json" }, Key = "format", Value = "auto", DefaultValue = "auto", Description = "确定用于日志的日志编码器。 可用选项包括auto,logfmt和json 。如果输出终端是TTY,则auto将使用更加用户友好的输出格式,但格式不易于机器读取。 当输出是非TTY时,auto将使用logfmt。默认值:“auto”" }; ConfigItem Logging_Level = new ConfigItem() { ItemType = ConfigItemType.字符串, Key = "level", Value = "info", DefaultValue = "info", Description = "确定将发出的日志级别。 可用的级别包括错误,警告,信息和调试。 将发出等于或高于指定级别的日志。默认值:“info”" }; ConfigItem Logging_Suppress_Logo = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "suppress-logo", Value = "true", DefaultValue = "true", Description = "禁止在程序启动时打印的徽标输出。 如果STDOUT不是TTY,则始终禁止使用徽标。默认值:false" }; LoggingItem.Description = "控制记录器如何将日志发送到输出"; LoggingItem.Name = "logging"; LoggingItem.Items.Add(Logging_Format); LoggingItem.Items.Add(Logging_Level); LoggingItem.Items.Add(Logging_Suppress_Logo); // [subscriber]:控制Kapacitor接受数据的配置。 ConfigItem Subscriber_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "enabled", Value = "true", DefaultValue = "true", Description = "是否启用该模块,默认值 :true" }; ConfigItem Subscriber_Http_Timeout = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "http-timeout", Value = "30s", DefaultValue = "30s", Description = "http超时时间,默认值:“30s”" }; ConfigItem Subscriber_Insecure_Skip_Verify = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "insecure-skip-verify", Value = "false", DefaultValue = "false", Description = "是否允许不安全的证书,当测试自己签发的证书时比较有用。默认值: false" }; ConfigItem Subscriber_Ca_Certs = new ConfigItem() { Key = "ca-certs", Value = "", DefaultValue = "", Description = "是否允许不安全的证书,当测试自己签发的证书时比较有用。默认值: false" }; ConfigItem Subscriber_Write_Concurrency = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "write-concurrency", Value = "40", DefaultValue = "40", Description = "设置并发数目,默认值:40" }; ConfigItem Subscriber_Write_Buffer_Size = new ConfigItem() { ItemType = ConfigItemType.数值, Key = "write-buffer-size", Value = "1000", DefaultValue = "1000", Description = "设置buffer大小,默认值:1000" }; SubscriberItem.Description = "控制Kapacitor接受数据的配置"; SubscriberItem.Name = "subscriber"; SubscriberItem.Items.Add(Subscriber_Enabled); SubscriberItem.Items.Add(Subscriber_Http_Timeout); SubscriberItem.Items.Add(Subscriber_Insecure_Skip_Verify); SubscriberItem.Items.Add(Subscriber_Ca_Certs); SubscriberItem.Items.Add(Subscriber_Write_Concurrency); SubscriberItem.Items.Add(Subscriber_Write_Buffer_Size); //[continuous_queries]:CQs配置。 ConfigItem Cqs_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "enabled", Value = "true", DefaultValue = "true", Description = "是否开启CQs,默认值:true" }; ConfigItem Cqs_Log_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "log-enabled", Value = "true", DefaultValue = "true", Description = "是否开启日志,默认值:true" }; ConfigItem Cqs_Uery_Stats_Enabled = new ConfigItem() { ItemType = ConfigItemType.布尔值, Key = "uery-stats-enabled", Value = "false", DefaultValue = "false", Description = "控制是否将查询记录到自我监视数据存储。默认值:false" }; ConfigItem Cqs_Run_Interval = new ConfigItem() { ItemType = ConfigItemType.时间单位, Key = "run-interval", Value = "1s", DefaultValue = "1s", Description = "检查连续查询是否需要运行的时间间隔,默认值:“1s”" }; Continuous_queriesItem.Description = "CQs配置"; Continuous_queriesItem.Name = "continuous_queries"; Continuous_queriesItem.Items.Add(Cqs_Enabled); Continuous_queriesItem.Items.Add(Cqs_Log_Enabled); Continuous_queriesItem.Items.Add(Cqs_Uery_Stats_Enabled); Continuous_queriesItem.Items.Add(Cqs_Run_Interval); ConfigItems.Clear(); ConfigItems.Add(HeadItem); ConfigItems.Add(MetaItem); ConfigItems.Add(DataItem); ConfigItems.Add(CoordinatorItem); ConfigItems.Add(RetentionItem); ConfigItems.Add(Shard_PrecreationItem); ConfigItems.Add(MonitorItem); ConfigItems.Add(HttpItem); ConfigItems.Add(LoggingItem); ConfigItems.Add(SubscriberItem); ConfigItems.Add(Continuous_queriesItem); }
private async Task LoginAsync(LoginInfo info) { uint instance = 0; if (info.AccountId != 0) { instance = 2; } else if (info.AccountType != AccountType.AnonUser) { instance = 1; } await NetLog.InfoAsync($"Logging in as {info.Username ?? (instance == 0 ? "an anonymous user" : "a console user")}").ConfigureAwait(false); byte[] machineId = await HardwareUtils.GetMachineId().ConfigureAwait(false); // while we set up the logon object, we will start to get the machine ID var body = new CMsgClientLogon { protocol_version = 65579, client_os_type = (uint)(info.AccountId == 0 ? HardwareUtils.GetCurrentOsType() : OsType.PS3), client_language = GetConfig <SteamNetworkConfig>().Language.GetApiLanguageCode(), cell_id = (uint)GetConfig <SteamNetworkConfig>().CellId, }; if (machineId != null && machineId.Length != 0) { body.machine_id = machineId; } if (info.AccountType != AccountType.AnonUser) { body.account_name = info.Username; body.password = info.Password; body.should_remember_password = info.ShouldRememberPassword; body.steam2_ticket_request = info.RequestSteam2Ticket; body.two_factor_code = info.TwoFactorCode; body.auth_code = info.AuthCode; body.login_key = info.LoginKey; body.sha_sentryfile = info.SentryFileHash; body.eresult_sentryfile = (int)(info.SentryFileHash is null ? Result.FileNotFound : Result.OK); body.client_package_version = 1771; body.obfustucated_private_ip = (uint)(GetConfig <SteamNetworkConfig>().LoginId < 0 ? LocalIp.ToUInt32() ^ _obfuscationMask : GetConfig <SteamNetworkConfig>().LoginId); body.supports_rate_limit_response = true; } var logon = NetworkMessage .CreateProtobufMessage(MessageType.ClientLogon, body) .WithClientInfo(new SteamId(info.AccountId, GetConfig <SteamNetworkConfig>().DefaultUniverse, info.AccountType, instance), 0); await SendAsync(logon.Serialize()).ConfigureAwait(false); }
public void ChangedNode() { this.Text = LocalIp.GetLocalIp(); this.ToolTipText = Server.SERVER_REMARK; }
/// <summary> /// Logs into the Steam network as an anonymous game server /// </summary> /// <param name="appId"></param> /// <returns></returns> public async Task LoginGameServerAnonymousAsync(int appId) { CMsgClientLogon logon = new CMsgClientLogon() { protocol_version = _currentProtocolVer, obfustucated_private_ip = (uint)(GetConfig <SteamNetworkConfig>().LoginId < 0 ? LocalIp.ToUInt32() ^ _obfuscationMask : GetConfig <SteamNetworkConfig>().LoginId), client_os_type = (uint)HardwareUtils.GetCurrentOsType(), game_server_app_id = appId, machine_id = await HardwareUtils.GetMachineId().ConfigureAwait(false), }; NetworkMessage message = NetworkMessage .CreateProtobufMessage(MessageType.ClientLogon, logon) .WithClientInfo(SteamId.CreateAnonymousGameServer(GetConfig <SteamNetworkConfig>().DefaultUniverse), 0); await SendAsync(message.Serialize()).ConfigureAwait(false); }
public override int GetHashCode() { return(LocalIp == null ? 0 : LocalIp.GetHashCode()); }
public static void InitBaseModel() { if (ServerID == "") { return; } try { DbHelperSQLite.connectionString = "Data Source=" + Application.StartupPath + "\\IOProject\\Station.station"; IO_SERVER serverBll = new IO_SERVER(); AddLogToMainLog("读取采集站信息......"); IOServer = serverBll.GetModel(mServerID); if (IOServer == null) { return; } mServerID = IOServer.SERVER_ID; IOServer.SERVER_IP = LocalIp.GetLocalIp(); serverBll.Update(IOServer); //加载通道 AddLogToMainLog("读取采集站通道信息......"); IO_COMMUNICATION commBll = new IO_COMMUNICATION(); SCADA_DRIVER DriverBll = new SCADA_DRIVER(); SCADA_DEVICE_DRIVER DeviceDriverBll = new SCADA_DEVICE_DRIVER(); CommDrivers = DriverBll.GetModelList(""); DeviceDrivers = DeviceDriverBll.GetModelList(""); IOCommunications = commBll.GetModelList(" IO_SERVER_ID='" + IOServer.SERVER_ID + "'"); AddLogToMainLog("读取采集站通道下的所有设备信息......"); IO_DEVICE deviceBll = new IO_DEVICE(); IODevices = deviceBll.GetModelList(" IO_SERVER_ID='" + IOServer.SERVER_ID + "'"); AddLogToMainLog("数据处理中....."); for (int i = 0; i < IOCommunications.Count; i++) { IOCommunications[i].DriverInfo = CommDrivers.Find(x => x.Id == IOCommunications[i].IO_COMM_DRIVER_ID); if (IOCommunications[i].DriverInfo != null) { IOCommunications[i].CommunicateDriver = DriverAssembly.CreateCommunicateDriver(IOCommunications[i].DriverInfo); } AddLogToMainLog("处理 " + IOCommunications[i].IO_COMM_NAME + "[" + IOCommunications[i].IO_COMM_LABEL + "]"); IOCommunications[i].Devices = IODevices.FindAll(x => x.IO_COMM_ID == IOCommunications[i].IO_COMM_ID && x.IO_SERVER_ID == IOCommunications[i].IO_SERVER_ID); for (int j = 0; j < IOCommunications[i].Devices.Count; j++) { IOCommunications[i].Devices[j].DriverInfo = DeviceDrivers.Find(x => x.Id == IOCommunications[i].Devices[j].DEVICE_DRIVER_ID); if (IOCommunications[i].Devices[j].DriverInfo != null) { IOCommunications[i].Devices[j].DeviceDrive = DriverAssembly.CreateDeviceDrive(IOCommunications[i].Devices[j].DriverInfo); } } } AddLogToMainLog("正在创建驱动....."); AddLogToMainLog("读取工程完成!"); ProgressMaxNum = IOCommunications.Count + IODevices.Count; } catch (Exception ex) { ThrowExceptionToMain(ex); } }