/// <summary> /// Construct the sls client with accessId, accessKey and server address, /// all other parameters will be set to default value /// </summary> /// <param name="endpoint">the sls server address(e.g.,http://cn-hangzhou.sls.aliyuncs.com)</param> /// <param name="accessKeyId">aliyun accessId</param> /// <param name="accessKey">aliyun accessKey</param> public LogClient(String endpoint, String accessKeyId, String accessKey, String securityToken) { if (!endpoint.StartsWith("http://") && !endpoint.StartsWith("https://")) { endpoint = "http://" + endpoint; } setEndpoint(endpoint); if (IpUtils.IsIpAddress(this._hostName)) { throw new LogException("LogClientError", "client error happens"); } _localMachinePrivateIp = IpUtils.GetLocalMachinePrivateIp(); _accessKeyId = accessKeyId; _accessKey = accessKey; _securityToken = securityToken; serviceClient = ServiceClient.Create(new ClientConfiguration()); serviceClient.Configuration.ConnectionTimeout = LogConsts.DEFAULT_SLS_CONNECT_TIMEOUT; serviceClient.Configuration.ReadWriteTimeout = LogConsts.DEFAULT_SLS_READWRT_TIMEOUT; }
public void IsIpAddressInvalidIpV6Test() { const string validIPv6 = "2001:db8:1234:0000"; Assert.IsFalse(IpUtils.IsIpAddress(validIPv6)); }
public void IsIpAddressValidIpV4Test() { const string validIPv4 = "172.16.254.1"; Assert.IsTrue(IpUtils.IsIpAddress(validIPv4)); }
public void IsIpAddressInvalidIpV4Test() { const string validIPv4 = "172.16.2541"; Assert.IsFalse(IpUtils.IsIpAddress(validIPv4)); }