src/Library/Consul.AspNetCore/BindingAddress.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;

namespace Consul.AspNetCore
{
    /// <summary>
    /// An address that a HTTP server may bind to.
    /// </summary>
    public class BindingAddress
    {
        private const string UnixPipeHostPrefix = "unix:/";

        private BindingAddress(string host, string pathBase, int port, string scheme)
        {
            Host = host;
            PathBase = pathBase;
            Port = port;
            Scheme = scheme;
        }

        /// <summary>
        /// Initializes a new instance of <see cref="BindingAddress"/>.
        /// </summary>
        [Obsolete("This constructor is obsolete and will be removed in a future version. Use BindingAddress.Parse(address) to create a BindingAddress instance.")]
        public BindingAddress()
        {
            throw new InvalidOperationException("This constructor is obsolete and will be removed in a future version. Use BindingAddress.Parse(address) to create a BindingAddress instance.");
        }

        /// <summary>
        /// Gets the host component.
        /// </summary>
        public string Host { get; }

        /// <summary>
        /// Gets the path component.
        /// </summary>
        public string PathBase { get; }

        /// <summary>
        /// Gets the port.
        /// </summary>
        public int Port { get; }

        /// <summary>
        /// Gets the scheme component.
        /// </summary>
        public string Scheme { get; }

        /// <summary>
        /// Gets a value that determines if this instance represents a Unix pipe.
        /// <para>
        /// Returns <see langword="true"/> if <see cref="Host"/> starts with <c>unix://</c> prefix.
        /// </para>
        /// </summary>
        public bool IsUnixPipe => Host.StartsWith(UnixPipeHostPrefix, StringComparison.Ordinal);

        /// <summary>
后面还有 171 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。