コード例 #1
0
ファイル: SwarmTest.cs プロジェクト: jakubbober/Catalyst
        public void IsAllowed_Peer()
        {
            var swarm = new SwarmService();
            var peer  = new Peer
            {
                Id        = "QmdpwjdB94eNm2Lcvp9JqoCxswo3AKQqjLuNZyLixmCM1h",
                Addresses = new MultiAddress[]
                {
                    "/ip4/127.0.0.1/ipfs/QmdpwjdB94eNm2Lcvp9JqoCxswo3AKQqjLuNZyLixmCM1h"
                }
            };

            Assert.IsTrue(swarm.IsAllowed(peer));

            swarm.BlackList.Add(peer.Addresses.First());
            Assert.IsFalse(swarm.IsAllowed(peer));

            swarm.BlackList.Clear();
            swarm.BlackList.Add("/p2p/QmdpwjdB94eNm2Lcvp9JqoCxswo3AKQqjLuNZyLixmCM1h");
            Assert.IsFalse(swarm.IsAllowed(peer));
        }